<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<meta name="description" content="Documentation and user's manual for innotop toolkit"/>
<meta name="keywords" content="MySQL"/> 
<meta name="author" content="Baron Schwartz"/> 
<link rel="stylesheet" type="text/css" href="default.css" media="screen"/>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/prototype/1.6.1.0/prototype.js"></script>
<script type="text/javascript" src="lightbox.js"></script>
<title>The Innotop Manual</title>
</head>
<body>
<div class="outer-container">
<div class="inner-container">
	<div class="header">
		<div class="title">
			<span class="sitename"><a href="index.html">Innotop User's Manual</a></span>
			<div class="slogan">Manual</div>
		</div>
	</div>
	<div class="path">
			<a href="index.html">Innotop Manual</a> &#8250; Manual
	</div>
	<div class="main">		
		<div class="content">

<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<li><a href="#synopsis">SYNOPSIS</a></li>
	<li><a href="#description">DESCRIPTION</a></li>
	<li><a href="#quick_start">QUICK-START</a></li>
	<li><a href="#options">OPTIONS</a></li>
	<li><a href="#hotkeys">HOTKEYS</a></li>
	<li><a href="#modes">MODES</a></li>
	<li><a href="#innotop_status">INNOTOP STATUS</a></li>
	<ul>

		<li><a href="#one_server">ONE SERVER</a></li>
		<li><a href="#multiple_servers">MULTIPLE SERVERS</a></li>
		<li><a href="#monitoring_a_file">MONITORING A FILE</a></li>
	</ul>

	<li><a href="#server_administration">SERVER ADMINISTRATION</a></li>
	<li><a href="#server_connections">SERVER CONNECTIONS</a></li>
	<li><a href="#server_groups">SERVER GROUPS</a></li>
	<li><a href="#switching_between_connections">SWITCHING BETWEEN CONNECTIONS</a></li>
	<li><a href="#error_handling">ERROR HANDLING</a></li>
	<li><a href="#non_interactive_operation">NON-INTERACTIVE OPERATION</a></li>
	<li><a href="#configuring">CONFIGURING</a></li>
	<li><a href="#configuration_file">CONFIGURATION FILE</a></li>
	<li><a href="#customizing">CUSTOMIZING</a></li>
	<ul>

		<li><a href="#tables">TABLES</a></li>
		<li><a href="#columns">COLUMNS</a></li>
		<li><a href="#filters">FILTERS</a></li>
		<ul>

			<li><a href="#user_defined_filters">USER-DEFINED FILTERS</a></li>
			<li><a href="#quick_filters">QUICK-FILTERS</a></li>
		</ul>

		<li><a href="#sorting">SORTING</a></li>
		<li><a href="#grouping">GROUPING</a></li>
		<li><a href="#pivoting">PIVOTING</a></li>
		<li><a href="#colors">COLORS</a></li>
		<li><a href="#expressions">EXPRESSIONS</a></li>
		<li><a href="#transformations">TRANSFORMATIONS</a></li>
		<li><a href="#table_editor">TABLE EDITOR</a></li>
	</ul>

	<li><a href="#variable_sets">VARIABLE SETS</a></li>
	<li><a href="#plugins">PLUGINS</a></li>
	<ul>

		<li><a href="#package_source_convention">Package Source Convention</a></li>
		<li><a href="#plugin_interface">Plugin Interface</a></li>
		<li><a href="#plugin_variables">Plugin Variables</a></li>
		<li><a href="#plugin_events">Plugin Events</a></li>
		<li><a href="#simple_plugin_example">Simple Plugin Example</a></li>
		<li><a href="#plugin_editor">Plugin Editor</a></li>
	</ul>

	<li><a href="#sql_statements">SQL STATEMENTS</a></li>
	<li><a href="#data_sources">DATA SOURCES</a></li>
	<li><a href="#mysql_privileges">MYSQL PRIVILEGES</a></li>
	<li><a href="#system_requirements">SYSTEM REQUIREMENTS</a></li>
	<li><a href="#files">FILES</a></li>
	<li><a href="#glossary_of_terms">GLOSSARY OF TERMS</a></li>
	<li><a href="#acknowledgements">ACKNOWLEDGEMENTS</a></li>
	<li><a href="#copyright__license_and_warranty">COPYRIGHT, LICENSE AND WARRANTY</a></li>
	<li><a href="#author">AUTHOR</a></li>
	<li><a href="#bugs">BUGS</a></li>
</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>innotop - MySQL and InnoDB transaction/status monitor.</p>
<p>
</p>
<hr />
<h1><a name="synopsis">SYNOPSIS</a></h1>
<p>To monitor servers normally:</p>
<pre>
 innotop</pre>
<p>To monitor InnoDB status information from a file:</p>
<pre>
 innotop /var/log/mysql/mysqld.err</pre>
<p>To run innotop non-interactively in a pipe-and-filter configuration:</p>
<pre>
 innotop --count 5 -d 1 -n</pre>
<p>To monitor a database on another system using a particular username and password:</p>
<pre>
 innotop -u &lt;username&gt; -p &lt;password&gt; -h &lt;hostname&gt;</pre>
<p>
</p>
<hr />
<h1><a name="description">DESCRIPTION</a></h1>
<p>innotop monitors MySQL servers.  Each of its modes shows you a different aspect
of what's happening in the server.  For example, there's a mode for monitoring
replication, one for queries, and one for transactions.  innotop refreshes its
data periodically, so you see an updating view.</p>
<p>innotop has lots of features for power users, but you can start and run it with
virtually no configuration.  If you're just getting started, see
<a href="#quick_start">QUICK-START</a>.  Press '?' at any time while running innotop for
context-sensitive help.</p>
<p>
</p>
<hr />
<h1><a name="quick_start">QUICK-START</a></h1>
<p>To start innotop, open a terminal or command prompt.  If you have installed
innotop on your system, you should be able to just type &quot;innotop&quot; and press
Enter; otherwise, you will need to change to innotop's directory and type &quot;perl
innotop&quot;.</p>
<p>With no options specified, innotop will attempt to connect to a MySQL server on
localhost using mysql_read_default_group=client for other connection
parameters.  If you need to specify a different username and password, use the
-u and -p options, respectively.  To monitor a MySQL database on another
host, use the -h option.</p>
<p>After you've connected, innotop should show you something like the following:</p>
<pre>
 [RO] Query List (? for help) localhost, 01:11:19, 449.44 QPS, 14/7/163 con/run
 
 CXN        When   Load  QPS    Slow  QCacheHit  KCacheHit  BpsIn    BpsOut 
 localhost  Total  0.00  1.07k   697      0.00%     98.17%  476.83k  242.83k</pre>
<pre>
 CXN        Cmd    ID         User  Host      DB   Time   Query
 localhost  Query  766446598  test  10.0.0.1  foo  00:02  INSERT INTO table (</pre>
<p>(This sample is truncated at the right so it will fit on a terminal when running
'man innotop')</p>
<p>If your server is busy, you'll see more output.  Notice the first line on the
screen, which tells you that readonly is set to true ([RO]), what mode you're
in and what server you're connected to.  You can change to other modes with
keystrokes; press 'T' to switch to a list of InnoDB transactions, for example.</p>
<p>Press the '?' key to see what keys are active in the current mode.  You can
press any of these keys and innotop will either take the requested action or
prompt you for more input.  If your system has Term::ReadLine support, you can
use TAB and other keys to auto-complete and edit input.</p>
<p>To quit innotop, press the 'q' key.</p>
<p>
</p>
<hr />
<h1><a name="options">OPTIONS</a></h1>
<p>innotop is mostly configured via its configuration file, but some of the
configuration options can come from the command line.  You can also specify a
file to monitor for InnoDB status output; see <a href="#monitoring_a_file">MONITORING A FILE</a> for more
details.</p>
<p>You can negate some options by prefixing the option name with --no.  For
example, --noinc (or --no-inc) negates <a href="#inc">--inc</a>.</p>
<dl>
<dt><strong><a name="color" class="item">--color</a></strong></dt>

<dd>
<p>Enable or disable terminal coloring.  Corresponds to the <a href="#color">color</a> config file
setting.</p>
</dd>
<dt><strong><a name="config" class="item">--config</a></strong></dt>

<dd>
<p>Specifies a configuration file to read.  This option is non-sticky, that is to
say it does not persist to the configuration file itself.</p>
</dd>
<dt><strong><a name="count" class="item">--count</a></strong></dt>

<dd>
<p>Refresh only the specified number of times (ticks) before exiting.  Each refresh
is a pause for <a href="#interval">interval</a> seconds, followed by requesting data from MySQL
connections and printing it to the terminal.</p>
</dd>
<dt><strong><a name="delay" class="item">--delay</a></strong></dt>

<dd>
<p>Specifies the amount of time to pause between ticks (refreshes).  Corresponds to
the configuration option <a href="#interval">interval</a>.</p>
</dd>
<dt><strong><a name="help" class="item">--help</a></strong></dt>

<dd>
<p>Print a summary of command-line usage and exit.</p>
</dd>
<dt><strong><a name="host" class="item">--host</a></strong></dt>

<dd>
<p>Host to connect to.</p>
</dd>
<dt><strong><a name="inc" class="item">--inc</a></strong></dt>

<dd>
<p>Specifies whether innotop should display absolute numbers or relative numbers
(offsets from their previous values).  Corresponds to the configuration option
<a href="#status_inc">status_inc</a>.</p>
</dd>
<dt><strong><a name="mode" class="item">--mode</a></strong></dt>

<dd>
<p>Specifies the mode in which innotop should start.  Corresponds to the
configuration option <a href="#mode">mode</a>.</p>
</dd>
<dt><strong><a name="nonint" class="item">--nonint</a></strong></dt>

<dd>
<p>Enable non-interactive operation.  See <a href="#non_interactive_operation">NON-INTERACTIVE OPERATION</a> for more.</p>
</dd>
<dt><strong><a name="password" class="item">--password</a></strong></dt>

<dd>
<p>Password to use for connection.</p>
</dd>
<dt><strong><a name="port" class="item">--port</a></strong></dt>

<dd>
<p>Port to use for connection.</p>
</dd>
<dt><strong><a name="skipcentral" class="item">--skipcentral</a></strong></dt>

<dd>
<p>Don't read the central configuration file.</p>
</dd>
<dt><strong><a name="timestamp" class="item">--timestamp</a></strong></dt>

<dd>
<p>In -n mode, write a timestamp either before every screenful of output, or if
the option is given twice, at the start of every line.  The format is controlled
by the timeformat config variable.</p>
</dd>
<dt><strong><a name="user" class="item">--user</a></strong></dt>

<dd>
<p>User to use for connection.</p>
</dd>
<dt><strong><a name="version" class="item">--version</a></strong></dt>

<dd>
<p>Output version information and exit.</p>
</dd>
<dt><strong><a name="write" class="item">--write</a></strong></dt>

<dd>
<p>Sets the configuration option <a href="#readonly">readonly</a> to 0, making innotop write the
running configuration to ~/.innotop/innotop.conf on exit, if no configuration
file was loaded at start-up.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="hotkeys">HOTKEYS</a></h1>
<p>innotop is interactive, and you control it with key-presses.</p>
<ul>
<li>
<p>Uppercase keys switch between modes.</p>
</li>
<li>
<p>Lowercase keys initiate some action within the current mode.</p>
</li>
<li>
<p>Other keys do something special like change configuration or show the
innotop license.</p>
</li>
</ul>
<p>Press '?' at any time to see the currently active keys and what they do.</p>
<p>
</p>
<hr />
<h1><a name="modes">MODES</a></h1>
<p>Each of innotop's modes retrieves and displays a particular type of data from
the servers you're monitoring.  You switch between modes with uppercase keys.
The following is a brief description of each mode, in alphabetical order.  To
switch to the mode, press the key listed in front of its heading in the
following list:</p>
<dl>
<dt><strong><a name="b_innodb_buffers" class="item">B: InnoDB Buffers</a></strong></dt>

<dd>
<p>This mode displays information about the InnoDB buffer pool, page statistics,
insert buffer, and adaptive hash index.  The data comes from SHOW INNODB STATUS.</p>
<p>This mode contains the <a href="#buffer_pool">buffer_pool</a>, <a href="#page_statistics">page_statistics</a>,
<a href="#insert_buffers">insert_buffers</a>, and <a href="#adaptive_hash_index">adaptive_hash_index</a> tables by default.</p>
</dd>
<dt><strong><a name="c_command_summary" class="item">C: Command Summary</a></strong></dt>

<dd>
<p>This mode is similar to mytop's Command Summary mode.  It shows the
<a href="#cmd_summary">cmd_summary</a> table, which looks something like the following:</p>
<pre>
 Command Summary (? for help) localhost, 25+07:16:43, 2.45 QPS, 3 thd, 5.0.40
 _____________________ Command Summary _____________________
 Name                    Value    Pct     Last Incr  Pct    
 Select_scan             3244858  69.89%          2  100.00%
 Select_range            1354177  29.17%          0    0.00%
 Select_full_join          39479   0.85%          0    0.00%
 Select_full_range_join     4097   0.09%          0    0.00%
 Select_range_check            0   0.00%          0    0.00%</pre>
<p>The command summary table is built by extracting variables from
<a href="#status_variables">STATUS_VARIABLES</a>.  The variables must be numeric and must match the prefix
given by the <a href="#cmd_filter">cmd_filter</a> configuration variable.  The variables are then
sorted by value descending and compared to the last variable, as shown above.
The percentage columns are percentage of the total of all variables in the
table, so you can see the relative weight of the variables.</p>
<p>The example shows what you see if the prefix is &quot;Select_&quot;.  The default
prefix is &quot;Com_&quot;.  You can choose a prefix with the 's' key.</p>
<p>It's rather like running SHOW VARIABLES LIKE &quot;prefix%&quot; with memory and
nice formatting.</p>
<p>Values are aggregated across all servers.  The Pct columns are not correctly
aggregated across multiple servers.  This is a known limitation of the grouping
algorithm that may be fixed in the future.</p>
</dd>
<dt><strong><a name="d_innodb_deadlocks" class="item">D: InnoDB Deadlocks</a></strong></dt>

<dd>
<p>This mode shows the transactions involved in the last InnoDB deadlock.  A second
table shows the locks each transaction held and waited for.  A deadlock is
caused by a cycle in the waits-for graph, so there should be two locks held and
one waited for unless the deadlock information is truncated.</p>
<p>InnoDB puts deadlock information before some other information in the SHOW
INNODB STATUS output.  If there are a lot of locks, the deadlock information can
grow very large, and there is a limit on the size of the SHOW INNODB
STATUS output.  A large deadlock can fill the entire output, or even be
truncated, and prevent you from seeing other information at all.  If you are
running innotop in another mode, for example T mode, and suddenly you don't see
anything, you might want to check and see if a deadlock has wiped out the data
you need.</p>
<p>If it has, you can create a small deadlock to replace the large one.  Use the
'w' key to 'wipe' the large deadlock with a small one.  This will not work
unless you have defined a deadlock table for the connection (see <a href="#server_connections">SERVER CONNECTIONS</a>).</p>
<p>You can also configure innotop to automatically detect when a large deadlock
needs to be replaced with a small one (see <a href="#auto_wipe_dl">auto_wipe_dl</a>).</p>
<p>This mode displays the <a href="#deadlock_transactions">deadlock_transactions</a> and <a href="#deadlock_locks">deadlock_locks</a> tables
by default.</p>
</dd>
<dt><strong><a name="f_innodb_foreign_key_errors" class="item">F: InnoDB Foreign Key Errors</a></strong></dt>

<dd>
<p>This mode shows the last InnoDB foreign key error information, such as the
table where it happened, when and who and what query caused it, and so on.</p>
<p>InnoDB has a huge variety of foreign key error messages, and many of them are
just hard to parse.  innotop doesn't always do the best job here, but there's
so much code devoted to parsing this messy, unparseable output that innotop is
likely never to be perfect in this regard.  If innotop doesn't show you what
you need to see, just look at the status text directly.</p>
<p>This mode displays the <a href="#fk_error">fk_error</a> table by default.</p>
</dd>
<dt><strong><a name="i_innodb_i_o_info" class="item">I: InnoDB I/O Info</a></strong></dt>

<dd>
<p>This mode shows InnoDB's I/O statistics, including the I/O threads, pending I/O,
file I/O miscellaneous, and log statistics.  It displays the <a href="#io_threads">io_threads</a>,
<a href="#pending_io">pending_io</a>, <a href="#file_io_misc">file_io_misc</a>, and <a href="#log_statistics">log_statistics</a> tables by default.</p>
</dd>
<dt><strong><a name="l_locks" class="item">L: Locks</a></strong></dt>

<dd>
<p>This mode shows information about current locks.  At the moment only InnoDB
locks are supported, and by default you'll only see locks for which transactions
are waiting.  This information comes from the TRANSACTIONS section of the InnoDB
status text.  If you have a very busy server, you may have frequent lock waits;
it helps to be able to see which tables and indexes are the &quot;hot spot&quot; for
locks.  If your server is running pretty well, this mode should show nothing.</p>
<p>You can configure MySQL and innotop to monitor not only locks for which a
transaction is waiting, but those currently held, too.  You can do this with the
InnoDB Lock Monitor (<a href="http://dev.mysql.com/doc/en/innodb-monitor.html">http://dev.mysql.com/doc/en/innodb-monitor.html</a>).  It's
not documented in the MySQL manual, but creating the lock monitor with the
following statement also affects the output of SHOW INNODB STATUS, which innotop
uses:</p>
<pre>
  CREATE TABLE innodb_lock_monitor(a int) ENGINE=INNODB;</pre>
<p>This causes InnoDB to print its output to the MySQL file every 16 seconds or so,
as stated in the manual, but it also makes the normal SHOW INNODB STATUS output
include lock information, which innotop can parse and display (that's the
undocumented feature).</p>
<p>This means you can do what may have seemed impossible: to a limited extent
(InnoDB truncates some information in the output), you can see which transaction
holds the locks something else is waiting for.  You can also enable and disable
the InnoDB Lock Monitor with the key mappings in this mode.</p>
<p>This mode displays the <a href="#innodb_locks">innodb_locks</a> table by default.  Here's a sample of
the screen when one connection is waiting for locks another connection holds:</p>
<pre>
 _________________________________ InnoDB Locks __________________________
 CXN        ID  Type    Waiting  Wait   Active  Mode  DB    Table  Index
 localhost  12  RECORD        1  00:10   00:10  X     test  t1     PRIMARY
 localhost  12  TABLE         0  00:10   00:10  IX    test  t1
 localhost  12  RECORD        1  00:10   00:10  X     test  t1     PRIMARY
 localhost  11  TABLE         0  00:00   00:25  IX    test  t1
 localhost  11  RECORD        0  00:00   00:25  X     test  t1     PRIMARY</pre>
<p>You can see the first connection, ID 12, is waiting for a lock on the PRIMARY
key on test.t1, and has been waiting for 10 seconds.  The second connection
isn't waiting, because the Waiting column is 0, but it holds locks on the same
index.  That tells you connection 11 is blocking connection 12.</p>
</dd>
<dt><strong><a name="m_master_slave_replication_status" class="item">M: Master/Slave Replication Status</a></strong></dt>

<dd>
<p>This mode shows the output of SHOW SLAVE STATUS and SHOW MASTER STATUS in three
tables.  The first two divide the slave's status into SQL and I/O thread status,
and the last shows master status.  Filters are applied to eliminate non-slave
servers from the slave tables, and non-master servers from the master table.</p>
<p>This mode displays the <a href="#slave_sql_status">slave_sql_status</a>, <a href="#slave_io_status">slave_io_status</a>, and
<a href="#master_status">master_status</a> tables by default.</p>
</dd>
<dt><strong><a name="o_open_tables" class="item">O: Open Tables</a></strong></dt>

<dd>
<p>This section comes from MySQL's SHOW OPEN TABLES command.  By default it is
filtered to show tables which are in use by one or more queries, so you can
get a quick look at which tables are 'hot'.  You can use this to guess which
tables might be locked implicitly.</p>
<p>This mode displays the <a href="#open_tables">open_tables</a> mode by default.</p>
</dd>
<dt><strong><a name="u_user_statistics" class="item">U: User Statistics</a></strong></dt>

<dd>
<p>This mode displays data that's available in Percona's enhanced version of MySQL
(also known as Percona Server with XtraDB).  Specifically, it makes it easy to
enable and disable the so-called &quot;user statistics.&quot;  This feature gathers stats
on clients, threads, users, tables, and indexes and makes them available as
INFORMATION_SCHEMA tables.  These are invaluable for understanding what your
server is doing.  They are also available in MariaDB.</p>
<p>The statistics supported so far are only from the TABLE_STATISTICS and
INDEX_STATISTICS tables added by Percona.  There are three views: one of table stats,
one of index stats (which can be aggregated with the = key), and one of both.</p>
<p>The server doesn't gather these stats by default.  You have to set the variable
userstat_running to turn it on.  You can do this easily with innotop from U mode,
with the 's' key.</p>
</dd>
<dt><strong><a name="q_query_list" class="item">Q: Query List</a></strong></dt>

<dd>
<p>This mode displays the output from SHOW FULL PROCESSLIST, much like <strong>mytop</strong>'s
query list mode.  This mode does <strong>not</strong> show InnoDB-related information.  This
is probably one of the most useful modes for general usage.</p>
<p>There is an informative header that shows general status information about
your server.  You can toggle it on and off with the 'h' key.  By default,
innotop hides inactive processes and its own process.  You can toggle these on
and off with the 'i' and 'a' keys.</p>
<p>You can EXPLAIN a query from this mode with the 'e' key.  This displays the
query's full text, the results of EXPLAIN, and in newer MySQL versions, even
the optimized query resulting from EXPLAIN EXTENDED.  innotop also tries to
rewrite certain queries to make them EXPLAIN-able.  For example, INSERT/SELECT
statements are rewritable.</p>
<p>This mode displays the <a href="#q_header">q_header</a> and <a href="#processlist">processlist</a> tables by default.</p>
</dd>
<dt><strong><a name="r_innodb_row_operations_and_semaphores" class="item">R: InnoDB Row Operations and Semaphores</a></strong></dt>

<dd>
<p>This mode shows InnoDB row operations, row operation miscellaneous, semaphores,
and information from the wait array.  It displays the <a href="#row_operations">row_operations</a>,
<a href="#row_operation_misc">row_operation_misc</a>, <a href="#semaphores">semaphores</a>, and <a href="#wait_array">wait_array</a> tables by default.</p>
</dd>
<dt><strong><a name="s_variables_status" class="item">S: Variables &amp; Status</a></strong></dt>

<dd>
<p>This mode calculates statistics, such as queries per second, and prints them out
in several different styles.  You can show absolute values, or incremental values
between ticks.</p>
<p>You can switch between the views by pressing a key.  The 's' key prints a
single line each time the screen updates, in the style of <strong>vmstat</strong>.  The 'g'
key changes the view to a graph of the same numbers, sort of like <strong>tload</strong>.
The 'v' key changes the view to a pivoted table of variable names on the left,
with successive updates scrolling across the screen from left to right.  You can
choose how many updates to put on the screen with the <a href="#num_status_sets">num_status_sets</a>
configuration variable.</p>
<p>Headers may be abbreviated to fit on the screen in interactive operation.  You
choose which variables to display with the 'c' key, which selects from
predefined sets, or lets you create your own sets.  You can edit the current set
with the 'e' key.</p>
<p>This mode doesn't really display any tables like other modes.  Instead, it uses
a table definition to extract and format the data, but it then transforms the
result in special ways before outputting it.  It uses the <a href="#var_status">var_status</a> table
definition for this.</p>
</dd>
<dt><strong><a name="t_innodb_transactions" class="item">T: InnoDB Transactions</a></strong></dt>

<dd>
<p>This mode shows transactions from the InnoDB monitor's output, in <strong>top</strong>-like
format.  This mode is the reason I wrote innotop.</p>
<p>You can kill queries or processes with the 'k' and 'x' keys, and EXPLAIN a query
with the 'e' or 'f' keys.  InnoDB doesn't print the full query in transactions,
so explaining may not work right if the query is truncated.</p>
<p>The informational header can be toggled on and off with the 'h' key.  By
default, innotop hides inactive transactions and its own transaction.  You can
toggle this on and off with the 'i' and 'a' keys.</p>
<p>This mode displays the <a href="#t_header">t_header</a> and <a href="#innodb_transactions">innodb_transactions</a> tables by
default.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="innotop_status">INNOTOP STATUS</a></h1>
<p>The first line innotop displays is a &quot;status bar&quot; of sorts.  What it contains
depends on the mode you're in, and what servers you're monitoring.  The first
few words are always [RO] (if readonly is set to 1), the innotop mode, such as
&quot;InnoDB Txns&quot; for T mode, followed by a reminder to press '?' for help at any
time.</p>
<p>
</p>
<h2><a name="one_server">ONE SERVER</a></h2>
<p>The simplest case is when you're monitoring a single server.  In this case, the
name of the connection is next on the status line.  This is the name you gave
when you created the connection -- most likely the MySQL server's hostname.
This is followed by the server's uptime.</p>
<p>If you're in an InnoDB mode, such as T or B, the next word is &quot;InnoDB&quot; followed
by some information about the SHOW INNODB STATUS output used to render the
screen.  The first word is the number of seconds since the last SHOW INNODB
STATUS, which InnoDB uses to calculate some per-second statistics.  The next is
a smiley face indicating whether the InnoDB output is truncated.  If the smiley
face is a :-), all is well; there is no truncation.  A :^| means the transaction
list is so long, InnoDB has only printed out some of the transactions.  Finally,
a frown :-( means the output is incomplete, which is probably due to a deadlock
printing too much lock information (see <a href="#d_innodb_deadlocks">D: InnoDB Deadlocks</a>).</p>
<p>The next two words indicate the server's queries per second (QPS) and how many
threads (connections) exist.  Finally, the server's version number is the last
thing on the line.</p>
<p>
</p>
<h2><a name="multiple_servers">MULTIPLE SERVERS</a></h2>
<p>If you are monitoring multiple servers (see <a href="#server_connections">SERVER CONNECTIONS</a>), the status
line does not show any details about individual servers.  Instead, it shows the
names of the connections that are active.  Again, these are connection names you
specified, which are likely to be the server's hostname.  A connection that has
an error is prefixed with an exclamation point.</p>
<p>If you are monitoring a group of servers (see <a href="#server_groups">SERVER GROUPS</a>), the status
line shows the name of the group.  If any connection in the group has an
error, the group's name is followed by the fraction of the connections that
don't have errors.</p>
<p>See <a href="#error_handling">ERROR HANDLING</a> for more details about innotop's error handling.</p>
<p>
</p>
<h2><a name="monitoring_a_file">MONITORING A FILE</a></h2>
<p>If you give a filename on the command line, innotop will not connect to ANY
servers at all.  It will watch the specified file for InnoDB status output and
use that as its data source.  It will always show a single connection called
'file'.  And since it can't connect to a server, it can't determine how long the
server it's monitoring has been up; so it calculates the server's uptime as time
since innotop started running.</p>
<p>
</p>
<hr />
<h1><a name="server_administration">SERVER ADMINISTRATION</a></h1>
<p>While innotop is primarily a monitor that lets you watch and analyze your
servers, it can also send commands to servers.  The most frequently useful
commands are killing queries and stopping or starting slaves.</p>
<p>You can kill a connection, or in newer versions of MySQL kill a query but not a
connection, from <a href="#q_query_list">Q: Query List</a> and <a href="#t_innodb_transactions">T: InnoDB Transactions</a> modes.
Press 'k' to issue a KILL command, or 'x' to issue a KILL QUERY command.
innotop will prompt you for the server and/or connection ID to kill (innotop
does not prompt you if there is only one possible choice for any input).
innotop pre-selects the longest-running query, or the oldest connection.
Confirm the command with 'y'.</p>
<p>In <a href="#m_master_slave_replication_status">M: Master/Slave Replication Status</a> mode, you can start and stop slaves
with the 'a' and 'o' keys, respectively.  You can send these commands to many
slaves at once.  innotop fills in a default command of START SLAVE or STOP SLAVE
for you, but you can actually edit the command and send anything you wish, such
as SET GLOBAL SQL_SLAVE_SKIP_COUNTER=1 to make the slave skip one binlog event
when it starts.</p>
<p>You can also ask innotop to calculate the earliest binlog in use by any slave
and issue a PURGE MASTER LOGS on the master.  Use the 'b' key for this.  innotop
will prompt you for a master to run the command on, then prompt you for the
connection names of that master's slaves (there is no way for innotop to
determine this reliably itself).  innotop will find the minimum binlog in use by
these slave connections and suggest it as the argument to PURGE MASTER LOGS.</p>
<p>in <a href="#u_user_statistics">U: User Statistics</a> mode, you can use the 's' key to start and stop
the collection of the statistics data for TABLE_STATISTICS and similar.</p>
<p>
</p>
<hr />
<h1><a name="server_connections">SERVER CONNECTIONS</a></h1>
<p>When you create a server connection using '@', innotop asks you for a series of
inputs, as follows:</p>
<dl>
<dt><strong><a name="dsn" class="item">DSN</a></strong></dt>

<dd>
<p>A DSN is a Data Source Name, which is the initial argument passed to the DBI
module for connecting to a server.  It is usually of the form</p>
<pre>
 DBI:mysql:;mysql_read_default_group=mysql;host=HOSTNAME</pre>
<p>Since this DSN is passed to the DBD::mysql driver, you should read the driver's
documentation at <a href="#http___search_cpan_org_dist_dbd_mysql_lib_dbd_mysql_pm"><a href="http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm">http://search.cpan.org/dist/DBD-mysql/lib/DBD/mysql.pm</a></a> for
the exact details on all the options you can pass the driver in the DSN.  You
can read more about DBI at <a href="http://dbi.perl.org/docs/">http://dbi.perl.org/docs/</a>, and especially at
<a href="http://search.cpan.org/~timb/DBI/DBI.pm">http://search.cpan.org/~timb/DBI/DBI.pm</a>.</p>
<p>The mysql_read_default_group=mysql option lets the DBD driver read your MySQL
options files, such as ~/.my.cnf on UNIX-ish systems.  You can use this to avoid
specifying a username or password for the connection.</p>
</dd>
<dt><strong><a name="innodb_deadlock_table" class="item">InnoDB Deadlock Table</a></strong></dt>

<dd>
<p>This optional item tells innotop a table name it can use to deliberately create
a small deadlock (see <a href="#d_innodb_deadlocks">D: InnoDB Deadlocks</a>).  If you specify this option,
you just need to be sure the table doesn't exist, and that innotop can create
and drop the table with the InnoDB storage engine.  You can safely omit or just
accept the default if you don't intend to use this.</p>
</dd>
<dt><strong><a name="username" class="item">Username</a></strong></dt>

<dd>
<p>innotop will ask you if you want to specify a username.  If you say 'y', it will
then prompt you for a user name.  If you have a MySQL option file that specifies
your username, you don't have to specify a username.</p>
<p>The username defaults to your login name on the system you're running innotop on.</p>
</dd>
<dt><strong><a name="password" class="item">Password</a></strong></dt>

<dd>
<p>innotop will ask you if you want to specify a password.  Like the username, the
password is optional, but there's an additional prompt that asks if you want to
save the password in the innotop configuration file.  If you don't save it in
the configuration file, innotop will prompt you for a password each time it
starts.  Passwords in the innotop configuration file are saved in plain text,
not encrypted in any way.</p>
</dd>
</dl>
<p>Once you finish answering these questions, you should be connected to a server.
But innotop isn't limited to monitoring a single server; you can define many
server connections and switch between them by pressing the '@' key.  See
<a href="#switching_between_connections">SWITCHING BETWEEN CONNECTIONS</a>.</p>
<p>
</p>
<hr />
<h1><a name="server_groups">SERVER GROUPS</a></h1>
<p>If you have multiple MySQL instances, you can put them into named groups, such
as 'all', 'masters', and 'slaves', which innotop can monitor all together.</p>
<p>You can choose which group to monitor with the '#' key, and you can press the
TAB key to switch to the next group.  If you're not currently monitoring a
group, pressing TAB selects the first group.</p>
<p>To create a group, press the '#' key and type the name of your new group, then
type the names of the connections you want the group to contain.</p>
<p>
</p>
<hr />
<h1><a name="switching_between_connections">SWITCHING BETWEEN CONNECTIONS</a></h1>
<p>innotop lets you quickly switch which servers you're monitoring.  The most basic
way is by pressing the '@' key and typing the name(s) of the connection(s) you
want to use.  This setting is per-mode, so you can monitor different connections
in each mode, and innotop remembers which connections you choose.</p>
<p>You can quickly switch to the 'next' connection in alphabetical order with the
'n' key.  If you're monitoring a server group (see <a href="#server_groups">SERVER GROUPS</a>) this will
switch to the first connection.</p>
<p>You can also type many connection names, and innotop will fetch and display data
from them all.  Just separate the connection names with spaces, for example
&quot;server1 server2.&quot;  Again, if you type the name of a connection that doesn't
exist, innotop will prompt you for connection information and create the
connection.</p>
<p>Another way to monitor multiple connections at once is with server groups.  You
can use the TAB key to switch to the 'next' group in alphabetical order, or if
you're not monitoring any groups, TAB will switch to the first group.</p>
<p>innotop does not fetch data in parallel from connections, so if you are
monitoring a large group or many connections, you may notice increased delay
between ticks.</p>
<p>When you monitor more than one connection, innotop's status bar changes.  See
<a href="#innotop_status">INNOTOP STATUS</a>.</p>
<p>
</p>
<hr />
<h1><a name="error_handling">ERROR HANDLING</a></h1>
<p>Error handling is not that important when monitoring a single connection, but is
crucial when you have many active connections.  A crashed server or lost
connection should not crash innotop.  As a result, innotop will continue to run
even when there is an error; it just won't display any information from the
connection that had an error.  Because of this, innotop's behavior might confuse
you.  It's a feature, not a bug!</p>
<p>innotop does not continue to query connections that have errors, because they
may slow innotop and make it hard to use, especially if the error is a problem
connecting and causes a long time-out.  Instead, innotop retries the connection
occasionally to see if the error still exists.  If so, it will wait until some
point in the future.  The wait time increases in ticks as the Fibonacci series,
so it tries less frequently as time passes.</p>
<p>Since errors might only happen in certain modes because of the SQL commands
issued in those modes, innotop keeps track of which mode caused the error.  If
you switch to a different mode, innotop will retry the connection instead of
waiting.</p>
<p>By default innotop will display the problem in red text at the bottom of the
first table on the screen.  You can disable this behavior with the
<a href="#show_cxn_errors_in_tbl">show_cxn_errors_in_tbl</a> configuration option, which is enabled by default.
If the <a href="#debug">debug</a> option is enabled, innotop will display the error at the
bottom of every table, not just the first.  And if <a href="#show_cxn_errors">show_cxn_errors</a> is
enabled, innotop will print the error text to STDOUT as well.  Error messages
might only display in the mode that caused the error, depending on the mode and
whether innotop is avoiding querying that connection.</p>
<p>
</p>
<hr />
<h1><a name="non_interactive_operation">NON-INTERACTIVE OPERATION</a></h1>
<p>You can run innotop in non-interactive mode, in which case it is entirely
controlled from the configuration file and command-line options.  To start
innotop in non-interactive mode, give the L&quot;&lt;--nonint&quot;&gt; command-line option.
This changes innotop's behavior in the following ways:</p>
<ul>
<li>
<p>Certain Perl modules are not loaded.  Term::Readline is not loaded, since
innotop doesn't prompt interactively.  Term::ANSIColor and Win32::Console::ANSI
modules are not loaded.  Term::ReadKey is still used, since innotop may have to
prompt for connection passwords when starting up.</p>
</li>
<li>
<p>innotop does not clear the screen after each tick.</p>
</li>
<li>
<p>innotop does not persist any changes to the configuration file.</p>
</li>
<li>
<p>If <a href="#count">--count</a> is given and innotop is in incremental mode (see <a href="#status_inc">status_inc</a>
and <a href="#inc">--inc</a>), innotop actually refreshes one more time than specified so it
can print incremental statistics.  This suppresses output during the first
tick, so innotop may appear to hang.</p>
</li>
<li>
<p>innotop only displays the first table in each mode.  This is so the output can
be easily processed with other command-line utilities such as awk and sed.  To
change which tables display in each mode, see <a href="#tables">TABLES</a>.  Since <a href="#q_query_list">Q: Query List</a> mode is so important, innotop automatically disables the <a href="#q_header">q_header</a>
table.  This ensures you'll see the <a href="#processlist">processlist</a> table, even if you have
innotop configured to show the q_header table during interactive operation.
Similarly, in <a href="#t_innodb_transactions">T: InnoDB Transactions</a> mode, the <a href="#t_header">t_header</a> table is
suppressed so you see only the <a href="#innodb_transactions">innodb_transactions</a> table.</p>
</li>
<li>
<p>All output is tab-separated instead of being column-aligned with whitespace, and
innotop prints the full contents of each table instead of only printing one
screenful at a time.</p>
</li>
<li>
<p>innotop only prints column headers once instead of every tick (see
<a href="#hide_hdr">hide_hdr</a>).  innotop does not print table captions (see
<a href="#display_table_captions">display_table_captions</a>).  innotop ensures there are no empty lines in the
output.</p>
</li>
<li>
<p>innotop does not honor the <a href="#shorten">shorten</a> transformation, which normally shortens
some numbers to human-readable formats.</p>
</li>
<li>
<p>innotop does not print a status line (see <a href="#innotop_status">INNOTOP STATUS</a>).</p>
</li>
</ul>
<p>
</p>
<hr />
<h1><a name="configuring">CONFIGURING</a></h1>
<p>Nearly everything about innotop is configurable.  Most things are possible to
change with built-in commands, but you can also edit the configuration file.</p>
<p>While running innotop, press the '$' key to bring up the configuration editing
dialog.  Press another key to select the type of data you want to edit:</p>
<dl>
<dt><strong><a name="s_statement_sleep_times" class="item">S: Statement Sleep Times</a></strong></dt>

<dd>
<p>Edits SQL statement sleep delays, which make innotop pause for the specified
amount of time after executing a statement.  See <a href="#sql_statements">SQL STATEMENTS</a> for a
definition of each statement and what it does.  By default innotop does not
delay after any statements.</p>
<p>This feature is included so you can customize the side-effects caused by
monitoring your server.  You may not see any effects, but some innotop users
have noticed that certain MySQL versions under very high load with InnoDB
enabled take longer than usual to execute SHOW GLOBAL STATUS.  If innotop calls
SHOW FULL PROCESSLIST immediately afterward, the processlist contains more
queries than the machine actually averages at any given moment.  Configuring
innotop to pause briefly after calling SHOW GLOBAL STATUS alleviates this
effect.</p>
<p>Sleep times are stored in the <a href="#stmt_sleep_times">stmt_sleep_times</a> section of the configuration
file.  Fractional-second sleeps are supported, subject to your hardware's
limitations.</p>
</dd>
<dt><strong><a name="c_edit_columns" class="item">c: Edit Columns</a></strong></dt>

<dd>
<p>Starts the table editor on one of the displayed tables.  See <a href="#table_editor">TABLE EDITOR</a>.
An alternative way to start the table editor without entering the configuration
dialog is with the '^' key.</p>
</dd>
<dt><strong><a name="g_general_configuration" class="item">g: General Configuration</a></strong></dt>

<dd>
<p>Starts the configuration editor to edit global and mode-specific configuration
variables (see <a href="#modes">MODES</a>).  innotop prompts you to choose a variable from among
the global and mode-specific ones depending on the current mode.</p>
</dd>
<dt><strong><a name="k_row_coloring_rules" class="item">k: Row-Coloring Rules</a></strong></dt>

<dd>
<p>Starts the row-coloring rules editor on one of the displayed table(s).  See
<a href="#colors">COLORS</a> for details.</p>
</dd>
<dt><strong><a name="p_manage_plugins" class="item">p: Manage Plugins</a></strong></dt>

<dd>
<p>Starts the plugin configuration editor.  See <a href="#plugins">PLUGINS</a> for details.</p>
</dd>
<dt><strong><a name="s_server_groups" class="item">s: Server Groups</a></strong></dt>

<dd>
<p>Lets you create and edit server groups.  See <a href="#server_groups">SERVER GROUPS</a>.</p>
</dd>
<dt><strong><a name="t_choose_displayed_tables" class="item">t: Choose Displayed Tables</a></strong></dt>

<dd>
<p>Lets you choose which tables to display in this mode.  See <a href="#modes">MODES</a> and
<a href="#tables">TABLES</a>.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="configuration_file">CONFIGURATION FILE</a></h1>
<p>innotop's default configuration file locations are $HOME/.innotop and
/etc/innotop/innotop.conf, and they are looked for in that order.  If the first
configuration file exists, the second will not be processed.  Those can be
overridden with the <a href="#config">--config</a> command-line option.  You can edit it by hand
safely, however innotop reads the configuration file when it starts, and, if
readonly is set to 0, writes it out again when it exits.  Thus, if readonly is
set to 0, any changes you make by hand while innotop is running will be lost.</p>
<p>innotop doesn't store its entire configuration in the configuration file.  It
has a huge set of default configuration values that it holds only in memory,
and the configuration file only overrides these defaults.  When you customize a
default setting, innotop notices, and then stores the customizations into the
file.  This keeps the file size down, makes it easier to edit, and makes
upgrades easier.</p>
<p>A configuration file is read-only be default.  You can override that with
<a href="#write">--write</a>.  See <a href="#readonly">readonly</a>.</p>
<p>The configuration file is arranged into sections like an INI file.  Each
section begins with [section-name] and ends with [/section-name].  Each
section's entries have a different syntax depending on the data they need to
store.  You can put comments in the file; any line that begins with a #
character is a comment.  innotop will not read the comments, so it won't write
them back out to the file when it exits.  Comments in read-only configuration
files are still useful, though.</p>
<p>The first line in the file is innotop's version number.  This lets innotop
notice when the file format is not backwards-compatible, and upgrade smoothly
without destroying your customized configuration.</p>
<p>The following list describes each section of the configuration file and the data
it contains:</p>
<dl>
<dt><strong><a name="general" class="item">general</a></strong></dt>

<dd>
<p>The 'general' section contains global configuration variables and variables that
may be mode-specific, but don't belong in any other section.  The syntax is a
simple key=value list.  innotop writes a comment above each value to help you
edit the file by hand.</p>
<dl>
<dt><strong><a name="s_func" class="item">S_func</a></strong></dt>

<dd>
<p>Controls S mode presentation (see <a href="#s_variables_status">S: Variables &amp; Status</a>).  If g, values are
graphed; if s, values are like vmstat; if p, values are in a pivoted table.</p>
</dd>
<dt><strong><a name="s_set" class="item">S_set</a></strong></dt>

<dd>
<p>Specifies which set of variables to display in <a href="#s_variables_status">S: Variables &amp; Status</a> mode.
See <a href="#variable_sets">VARIABLE SETS</a>.</p>
</dd>
<dt><strong><a name="auto_wipe_dl" class="item">auto_wipe_dl</a></strong></dt>

<dd>
<p>Instructs innotop to automatically wipe large deadlocks when it notices them.
When this happens you may notice a slight delay.  At the next tick, you will
usually see the information that was being truncated by the large deadlock.</p>
</dd>
<dt><strong><a name="charset" class="item">charset</a></strong></dt>

<dd>
<p>Specifies what kind of characters to allow through the <a href="#no_ctrl_char">no_ctrl_char</a>
transformation.  This keeps non-printable characters from confusing a
terminal when you monitor queries that contain binary data, such as images.</p>
<p>The default is 'ascii', which considers anything outside normal ASCII to be a
control character.  The other allowable values are 'unicode' and 'none'.  'none'
considers every character a control character, which can be useful for
collapsing ALL text fields in queries.</p>
</dd>
<dt><strong><a name="cmd_filter" class="item">cmd_filter</a></strong></dt>

<dd>
<p>This is the prefix that filters variables in <a href="#c_command_summary">C: Command Summary</a> mode.</p>
</dd>
<dt><strong>color</strong></dt>

<dd>
<p>Whether terminal coloring is permitted.</p>
</dd>
<dt><strong><a name="cxn_timeout" class="item">cxn_timeout</a></strong></dt>

<dd>
<p>On MySQL versions 4.0.3 and newer, this variable is used to set the connection's
timeout, so MySQL doesn't close the connection if it is not used for a while.
This might happen because a connection isn't monitored in a particular mode, for
example.</p>
</dd>
<dt><strong><a name="debug" class="item">debug</a></strong></dt>

<dd>
<p>This option enables more verbose errors and makes innotop more strict in some
places.  It can help in debugging filters and other user-defined code.  It also
makes innotop write a lot of information to <a href="#debugfile">debugfile</a> when there is a
crash.</p>
</dd>
<dt><strong><a name="debugfile" class="item">debugfile</a></strong></dt>

<dd>
<p>A file to which innotop will write information when there is a crash.  See
<a href="#files">FILES</a>.</p>
</dd>
<dt><strong><a name="display_table_captions" class="item">display_table_captions</a></strong></dt>

<dd>
<p>innotop displays a table caption above most tables.  This variable suppresses or
shows captions on all tables globally.  Some tables are configured with the
hide_caption property, which overrides this.</p>
</dd>
<dt><strong><a name="global" class="item">global</a></strong></dt>

<dd>
<p>Whether to show GLOBAL variables and status.  innotop only tries to do this on
servers which support the GLOBAL option to SHOW VARIABLES and SHOW STATUS.  In
some MySQL versions, you need certain privileges to do this; if you don't have
them, innotop will not be able to fetch any variable and status data.  This
configuration variable lets you run innotop and fetch what data you can even
without the elevated privileges.</p>
<p>I can no longer find or reproduce the situation where GLOBAL wasn't allowed, but
I know there was one.</p>
</dd>
<dt><strong><a name="graph_char" class="item">graph_char</a></strong></dt>

<dd>
<p>Defines the character to use when drawing graphs in <a href="#s_variables_status">S: Variables &amp; Status</a>
mode.</p>
</dd>
<dt><strong><a name="header_highlight" class="item">header_highlight</a></strong></dt>

<dd>
<p>Defines how to highlight column headers.  This only works if Term::ANSIColor is
available.  Valid values are 'bold' and 'underline'.</p>
</dd>
<dt><strong><a name="hide_hdr" class="item">hide_hdr</a></strong></dt>

<dd>
<p>Hides column headers globally.</p>
</dd>
<dt><strong><a name="interval" class="item">interval</a></strong></dt>

<dd>
<p>The interval at which innotop will refresh its data (ticks).  The interval is
implemented as a sleep time between ticks, so the true interval will vary
depending on how long it takes innotop to fetch and render data.</p>
<p>This variable accepts fractions of a second.</p>
</dd>
<dt><strong>mode</strong></dt>

<dd>
<p>The mode in which innotop should start.  Allowable arguments are the same as the
key presses that select a mode interactively.  See <a href="#modes">MODES</a>.</p>
</dd>
<dt><strong><a name="num_digits" class="item">num_digits</a></strong></dt>

<dd>
<p>How many digits to show in fractional numbers and percents.  This variable's
range is between 0 and 9 and can be set directly from <a href="#s_variables_status">S: Variables &amp; Status</a>
mode with the '+' and '-' keys.  It is used in the <a href="#set_precision">set_precision</a>,
<a href="#shorten">shorten</a>, and <a href="#percent">percent</a> transformations.</p>
</dd>
<dt><strong><a name="num_status_sets" class="item">num_status_sets</a></strong></dt>

<dd>
<p>Controls how many sets of status variables to display in pivoted <a href="#s_variables_status">S: Variables &amp; Status</a> mode.  It also controls the number of old sets of variables innotop
keeps in its memory, so the larger this variable is, the more memory innotop
uses.</p>
</dd>
<dt><strong><a name="plugin_dir" class="item">plugin_dir</a></strong></dt>

<dd>
<p>Specifies where plugins can be found.  By default, innotop stores plugins in the
'plugins' subdirectory of your innotop configuration directory.</p>
</dd>
<dt><strong><a name="readonly" class="item">readonly</a></strong></dt>

<dd>
<p>Whether the configuration file is readonly.  This cannot be set interactively.</p>
</dd>
<dt><strong><a name="show_cxn_errors" class="item">show_cxn_errors</a></strong></dt>

<dd>
<p>Makes innotop print connection errors to STDOUT.  See <a href="#error_handling">ERROR HANDLING</a>.</p>
</dd>
<dt><strong><a name="show_cxn_errors_in_tbl" class="item">show_cxn_errors_in_tbl</a></strong></dt>

<dd>
<p>Makes innotop display connection errors as rows in the first table on screen.
See <a href="#error_handling">ERROR HANDLING</a>.</p>
</dd>
<dt><strong><a name="show_percent" class="item">show_percent</a></strong></dt>

<dd>
<p>Adds a '%' character after the value returned by the <a href="#percent">percent</a>
transformation.</p>
</dd>
<dt><strong><a name="show_statusbar" class="item">show_statusbar</a></strong></dt>

<dd>
<p>Controls whether to show the status bar in the display.  See <a href="#innotop_status">INNOTOP STATUS</a>.</p>
</dd>
<dt><strong><a name="skip_innodb" class="item">skip_innodb</a></strong></dt>

<dd>
<p>Disables fetching SHOW INNODB STATUS, in case your server(s) do not have InnoDB
enabled and you don't want innotop to try to fetch it.  This can also be useful
when you don't have the SUPER privilege, required to run SHOW INNODB STATUS.</p>
</dd>
<dt><strong><a name="status_inc" class="item">status_inc</a></strong></dt>

<dd>
<p>Whether to show absolute or incremental values for status variables.
Incremental values are calculated as an offset from the last value innotop saw
for that variable.  This is a global setting, but will probably become
mode-specific at some point.  Right now it is honored a bit inconsistently; some
modes don't pay attention to it.</p>
</dd>
<dt><strong><a name="timeformat" class="item">timeformat</a></strong></dt>

<dd>
<p>The C-style strftime()-compatible format for the timestamp line to be printed
in -n mode when -t is set.</p>
</dd>
</dl>
</dd>
<dt><strong><a name="plugins" class="item">plugins</a></strong></dt>

<dd>
<p>This section holds a list of package names of active plugins.  If the plugin
exists, innotop will activate it.  See <a href="#plugins">PLUGINS</a> for more information.</p>
</dd>
<dt><strong><a name="filters" class="item">filters</a></strong></dt>

<dd>
<p>This section holds user-defined filters (see <a href="#filters">FILTERS</a>).  Each line is in the
format filter_name=text='filter text' tbls='table list'.</p>
<p>The filter text is the text of the subroutine's code.  The table list is a list
of tables to which the filter can apply.  By default, user-defined filters apply
to the table for which they were created, but you can manually override that by
editing the definition in the configuration file.</p>
</dd>
<dt><strong><a name="active_filters" class="item">active_filters</a></strong></dt>

<dd>
<p>This section stores which filters are active on each table.  Each line is in the
format table_name=filter_list.</p>
</dd>
<dt><strong><a name="tbl_meta" class="item">tbl_meta</a></strong></dt>

<dd>
<p>This section stores user-defined or user-customized columns (see <a href="#columns">COLUMNS</a>).
Each line is in the format col_name=properties, where the properties are a
name=quoted-value list.</p>
</dd>
<dt><strong><a name="connections" class="item">connections</a></strong></dt>

<dd>
<p>This section holds the server connections you have defined.  Each line is in
the format name=properties, where the properties are a name=value list.  The
properties are self-explanatory, and the only one that is treated specially is
'pass' which is only present if 'savepass' is set.  This section of the
configuration file will be skipped if any DSN, username, or password
command-line options are used.  See <a href="#server_connections">SERVER CONNECTIONS</a>.</p>
</dd>
<dt><strong><a name="active_connections" class="item">active_connections</a></strong></dt>

<dd>
<p>This section holds a list of which connections are active in each mode.  Each
line is in the format mode_name=connection_list.</p>
</dd>
<dt><strong><a name="server_groups" class="item">server_groups</a></strong></dt>

<dd>
<p>This section holds server groups.  Each line is in the format
name=connection_list.  See <a href="#server_groups">SERVER GROUPS</a>.</p>
</dd>
<dt><strong><a name="active_server_groups" class="item">active_server_groups</a></strong></dt>

<dd>
<p>This section holds a list of which server group is active in each mode.  Each
line is in the format mode_name=server_group.</p>
</dd>
<dt><strong><a name="max_values_seen" class="item">max_values_seen</a></strong></dt>

<dd>
<p>This section holds the maximum values seen for variables.  This is used to scale
the graphs in <a href="#s_variables_status">S: Variables &amp; Status</a> mode.  Each line is in the format
name=value.</p>
</dd>
<dt><strong><a name="active_columns" class="item">active_columns</a></strong></dt>

<dd>
<p>This section holds table column lists.  Each line is in the format
tbl_name=column_list.  See <a href="#columns">COLUMNS</a>.</p>
</dd>
<dt><strong><a name="sort_cols" class="item">sort_cols</a></strong></dt>

<dd>
<p>This section holds the sort definition.  Each line is in the format
tbl_name=column_list.  If a column is prefixed with '-', that column sorts
descending.  See <a href="#sorting">SORTING</a>.</p>
</dd>
<dt><strong><a name="visible_tables" class="item">visible_tables</a></strong></dt>

<dd>
<p>This section defines which tables are visible in each mode.  Each line is in the
format mode_name=table_list.  See <a href="#tables">TABLES</a>.</p>
</dd>
<dt><strong><a name="varsets" class="item">varsets</a></strong></dt>

<dd>
<p>This section defines variable sets for use in <a href="#s__status___variables">S: Status &amp; Variables</a> mode.
Each line is in the format name=variable_list.  See <a href="#variable_sets">VARIABLE SETS</a>.</p>
</dd>
<dt><strong><a name="colors" class="item">colors</a></strong></dt>

<dd>
<p>This section defines colorization rules.  Each line is in the format
tbl_name=property_list.  See <a href="#colors">COLORS</a>.</p>
</dd>
<dt><strong><a name="stmt_sleep_times" class="item">stmt_sleep_times</a></strong></dt>

<dd>
<p>This section contains statement sleep times.  Each line is in the format
statement_name=sleep_time.  See <a href="#s_statement_sleep_times">S: Statement Sleep Times</a>.</p>
</dd>
<dt><strong><a name="group_by" class="item">group_by</a></strong></dt>

<dd>
<p>This section contains column lists for table group_by expressions.  Each line is
in the format tbl_name=column_list.  See <a href="#grouping">GROUPING</a>.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="customizing">CUSTOMIZING</a></h1>
<p>You can customize innotop a great deal.  For example, you can:</p>
<ul>
<li>
<p>Choose which tables to display, and in what order.</p>
</li>
<li>
<p>Choose which columns are in those tables, and create new columns.</p>
</li>
<li>
<p>Filter which rows display with built-in filters, user-defined filters, and
quick-filters.</p>
</li>
<li>
<p>Sort the rows to put important data first or group together related rows.</p>
</li>
<li>
<p>Highlight rows with color.</p>
</li>
<li>
<p>Customize the alignment, width, and formatting of columns, and apply
transformations to columns to extract parts of their values or format the values
as you wish (for example, shortening large numbers to familiar units).</p>
</li>
<li>
<p>Design your own expressions to extract and combine data as you need.  This gives
you unlimited flexibility.</p>
</li>
</ul>
<p>All these and more are explained in the following sections.</p>
<p>
</p>
<h2><a name="tables">TABLES</a></h2>
<p>A table is what you'd expect: a collection of columns.  It also has some other
properties, such as a caption.  Filters, sorting rules, and colorization rules
belong to tables and are covered in later sections.</p>
<p>Internally, table meta-data is defined in a data structure called %tbl_meta.
This hash holds all built-in table definitions, which contain a lot of default
instructions to innotop.  The meta-data includes the caption, a list of columns
the user has customized, a list of columns, a list of visible columns, a list of
filters, color rules, a sort-column list, sort direction, and some information
about the table's data sources.  Most of this is customizable via the table
editor (see <a href="#table_editor">TABLE EDITOR</a>).</p>
<p>You can choose which tables to show by pressing the '$' key.  See <a href="#modes">MODES</a> and
<a href="#tables">TABLES</a>.</p>
<p>The table life-cycle is as follows:</p>
<ul>
<li>
<p>Each table begins with a data source, which is an array of hashes.  See below
for details on data sources.</p>
</li>
<li>
<p>Each element of the data source becomes a row in the final table.</p>
</li>
<li>
<p>For each element in the data source, innotop extracts values from the source and
creates a row.  This row is another hash, which later steps will refer to as
$set.  The values innotop extracts are determined by the table's columns.  Each
column has an extraction subroutine, compiled from an expression (see
<a href="#expressions">EXPRESSIONS</a>).  The resulting row is a hash whose keys are named the same as
the column name.</p>
</li>
<li>
<p>innotop filters the rows, removing those that don't need to be displayed.  See
<a href="#filters">FILTERS</a>.</p>
</li>
<li>
<p>innotop sorts the rows.  See <a href="#sorting">SORTING</a>.</p>
</li>
<li>
<p>innotop groups the rows together, if specified.  See <a href="#grouping">GROUPING</a>.</p>
</li>
<li>
<p>innotop colorizes the rows.  See <a href="#colors">COLORS</a>.</p>
</li>
<li>
<p>innotop transforms the column values in each row.  See <a href="#transformations">TRANSFORMATIONS</a>.</p>
</li>
<li>
<p>innotop optionally pivots the rows (see <a href="#pivoting">PIVOTING</a>), then filters and sorts
them.</p>
</li>
<li>
<p>innotop formats and justifies the rows as a table.  During this step, innotop
applies further formatting to the column values, including alignment, maximum
and minimum widths.  innotop also does final error checking to ensure there are
no crashes due to undefined values.  innotop then adds a caption if specified,
and the table is ready to print.</p>
</li>
</ul>
<p>The lifecycle is slightly different if the table is pivoted, as noted above.  To
clarify, if the table is pivoted, the process is extract, group, transform,
pivot, filter, sort, create.  If it's not pivoted, the process is extract,
filter, sort, group, color, transform, create.  This slightly convoluted process
doesn't map all that well to SQL, but pivoting complicates things pretty
thoroughly.  Roughly speaking, filtering and sorting happen as late as needed to
effect the final result as you might expect, but as early as possible for
efficiency.</p>
<p>Each built-in table is described below:</p>
<dl>
<dt><strong><a name="adaptive_hash_index" class="item">adaptive_hash_index</a></strong></dt>

<dd>
<p>Displays data about InnoDB's adaptive hash index.  Data source:
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="buffer_pool" class="item">buffer_pool</a></strong></dt>

<dd>
<p>Displays data about InnoDB's buffer pool.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="cmd_summary" class="item">cmd_summary</a></strong></dt>

<dd>
<p>Displays weighted status variables.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="deadlock_locks" class="item">deadlock_locks</a></strong></dt>

<dd>
<p>Shows which locks were held and waited for by the last detected deadlock.  Data
source: <a href="#deadlock_locks">DEADLOCK_LOCKS</a>.</p>
</dd>
<dt><strong><a name="deadlock_transactions" class="item">deadlock_transactions</a></strong></dt>

<dd>
<p>Shows transactions involved in the last detected deadlock.  Data source:
<a href="#deadlock_transactions">DEADLOCK_TRANSACTIONS</a>.</p>
</dd>
<dt><strong><a name="explain" class="item">explain</a></strong></dt>

<dd>
<p>Shows the output of EXPLAIN.  Data source: <a href="#explain">EXPLAIN</a>.</p>
</dd>
<dt><strong><a name="file_io_misc" class="item">file_io_misc</a></strong></dt>

<dd>
<p>Displays data about InnoDB's file and I/O operations.  Data source:
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="fk_error" class="item">fk_error</a></strong></dt>

<dd>
<p>Displays various data about InnoDB's last foreign key error.  Data source:
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="index_statistics" class="item">index_statistics</a></strong></dt>

<dd>
<p>Displays data from the INDEX_STATISTICS table in Percona-enhanced servers.</p>
</dd>
<dt><strong><a name="index_table_statistics" class="item">index_table_statistics</a></strong></dt>

<dd>
<p>Displays data from the INDEX_STATISTICS and TABLE_STATISTICS tables in
Percona-enhanced servers.  It joins the two together, grouped by the database
and table name.  It is the default view in <a href="#u_user_statistics">U: User Statistics</a> mode,
and makes it easy to see what tables are hot, how many rows are read from indexes,
how many changes are made, and how many changes are made to indexes.</p>
</dd>
<dt><strong><a name="innodb_locks" class="item">innodb_locks</a></strong></dt>

<dd>
<p>Displays InnoDB locks.  Data source: <a href="#innodb_locks">INNODB_LOCKS</a>.</p>
</dd>
<dt><strong><a name="innodb_transactions" class="item">innodb_transactions</a></strong></dt>

<dd>
<p>Displays data about InnoDB's current transactions.  Data source:
<a href="#innodb_transactions">INNODB_TRANSACTIONS</a>.</p>
</dd>
<dt><strong><a name="insert_buffers" class="item">insert_buffers</a></strong></dt>

<dd>
<p>Displays data about InnoDB's insert buffer.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="io_threads" class="item">io_threads</a></strong></dt>

<dd>
<p>Displays data about InnoDB's I/O threads.  Data source: <a href="#io_threads">IO_THREADS</a>.</p>
</dd>
<dt><strong><a name="log_statistics" class="item">log_statistics</a></strong></dt>

<dd>
<p>Displays data about InnoDB's logging system.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="master_status" class="item">master_status</a></strong></dt>

<dd>
<p>Displays replication master status.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="open_tables" class="item">open_tables</a></strong></dt>

<dd>
<p>Displays open tables.  Data source: <a href="#open_tables">OPEN_TABLES</a>.</p>
</dd>
<dt><strong><a name="page_statistics" class="item">page_statistics</a></strong></dt>

<dd>
<p>Displays InnoDB page statistics.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="pending_io" class="item">pending_io</a></strong></dt>

<dd>
<p>Displays InnoDB pending I/O operations.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="processlist" class="item">processlist</a></strong></dt>

<dd>
<p>Displays current MySQL processes (threads/connections).  Data source:
<a href="#processlist">PROCESSLIST</a>.</p>
</dd>
<dt><strong><a name="q_header" class="item">q_header</a></strong></dt>

<dd>
<p>Displays various status values.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="row_operation_misc" class="item">row_operation_misc</a></strong></dt>

<dd>
<p>Displays data about InnoDB's row operations.  Data source:
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="row_operations" class="item">row_operations</a></strong></dt>

<dd>
<p>Displays data about InnoDB's row operations.  Data source:
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="semaphores" class="item">semaphores</a></strong></dt>

<dd>
<p>Displays data about InnoDB's semaphores and mutexes.  Data source:
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="slave_io_status" class="item">slave_io_status</a></strong></dt>

<dd>
<p>Displays data about the slave I/O thread.  Data source: 
<a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="slave_sql_status" class="item">slave_sql_status</a></strong></dt>

<dd>
<p>Displays data about the slave SQL thread.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="table_statistics" class="item">table_statistics</a></strong></dt>

<dd>
<p>Displays data from the TABLE_STATISTICS table in Percona-enhanced servers.</p>
</dd>
<dt><strong><a name="t_header" class="item">t_header</a></strong></dt>

<dd>
<p>Displays various InnoDB status values.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="var_status" class="item">var_status</a></strong></dt>

<dd>
<p>Displays user-configurable data.  Data source: <a href="#status_variables">STATUS_VARIABLES</a>.</p>
</dd>
<dt><strong><a name="wait_array" class="item">wait_array</a></strong></dt>

<dd>
<p>Displays data about InnoDB's OS wait array.  Data source: <a href="#os_wait_array">OS_WAIT_ARRAY</a>.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="columns">COLUMNS</a></h2>
<p>Columns belong to tables.  You can choose a table's columns by pressing the '^'
key, which starts the <a href="#table_editor">TABLE EDITOR</a> and lets you choose and edit columns.
Pressing 'e' from within the table editor lets you edit the column's properties:</p>
<ul>
<li>
<p>hdr: a column header.  This appears in the first row of the table.</p>
</li>
<li>
<p>just: justification.  '-' means left-justified and '' means right-justified,
just as with printf formatting codes (not a coincidence).</p>
</li>
<li>
<p>dec: whether to further align the column on the decimal point.</p>
</li>
<li>
<p>num: whether the column is numeric.  This affects how values are sorted
(lexically or numerically).</p>
</li>
<li>
<p>label: a small note about the column, which appears in dialogs that help the
user choose columns.</p>
</li>
<li>
<p>src: an expression that innotop uses to extract the column's data from its
source (see <a href="#data_sources">DATA SOURCES</a>).  See <a href="#expressions">EXPRESSIONS</a> for more on expressions.</p>
</li>
<li>
<p>minw: specifies a minimum display width.  This helps stabilize the display,
which makes it easier to read if the data is changing frequently.</p>
</li>
<li>
<p>maxw: similar to minw.</p>
</li>
<li>
<p>trans: a list of column transformations.  See <a href="#transformations">TRANSFORMATIONS</a>.</p>
</li>
<li>
<p>agg: an aggregate function.  See <a href="#grouping">GROUPING</a>.  The default is <a href="#first">first</a>.</p>
</li>
<li>
<p>aggonly: controls whether the column only shows when grouping is enabled on the
table (see <a href="#grouping">GROUPING</a>).  By default, this is disabled.  This means columns
will always be shown by default, whether grouping is enabled or not.  If a
column's aggonly is set true, the column will appear when you toggle grouping on
the table.  Several columns are set this way, such as the count column on
<a href="#processlist">processlist</a> and <a href="#innodb_transactions">innodb_transactions</a>, so you don't see a count when the
grouping isn't enabled, but you do when it is.</p>
</li>
<li>
<p>agghide: the reverse of aggonly.  The column is hidden when grouping is enabled.</p>
</li>
</ul>
<p>
</p>
<h2><a name="filters">FILTERS</a></h2>
<p>Filters remove rows from the display.  They behave much like a WHERE clause in
SQL.  innotop has several built-in filters, which remove irrelevant information
like inactive queries, but you can define your own as well.  innotop also lets
you create quick-filters, which do not get saved to the configuration file, and
are just an easy way to quickly view only some rows.</p>
<p>You can enable or disable a filter on any table.  Press the '%' key (mnemonic: %
looks kind of like a line being filtered between two circles) and choose which
table you want to filter, if asked.  You'll then see a list of possible filters
and a list of filters currently enabled for that table.  Type the names of
filters you want to apply and press Enter.</p>
<p>
</p>
<h3><a name="user_defined_filters">USER-DEFINED FILTERS</a></h3>
<p>If you type a name that doesn't exist, innotop will prompt you to create the
filter.  Filters are easy to create if you know Perl, and not hard if you don't.
What you're doing is creating a subroutine that returns true if the row should
be displayed.  The row is a hash reference passed to your subroutine as $set.</p>
<p>For example, imagine you want to filter the processlist table so you only see
queries that have been running more than five minutes.  Type a new name for your
filter, and when prompted for the subroutine body, press TAB to initiate your
terminal's auto-completion.  You'll see the names of the columns in the
<a href="#processlist">processlist</a> table (innotop generally tries to help you with auto-completion
lists).  You want to filter on the 'time' column.  Type the text &quot;$set-&gt;{time} &gt;
300&quot; to return true when the query is more than five minutes old.  That's all
you need to do.</p>
<p>In other words, the code you're typing is surrounded by an implicit context,
which looks like this:</p>
<pre>
 sub filter {
    my ( $set ) = @_;
    # YOUR CODE HERE
 }</pre>
<p>If your filter doesn't work, or if something else suddenly behaves differently,
you might have made an error in your filter, and innotop is silently catching
the error.  Try enabling <a href="#debug">debug</a> to make innotop throw an error instead.</p>
<p>
</p>
<h3><a name="quick_filters">QUICK-FILTERS</a></h3>
<p>innotop's quick-filters are a shortcut to create a temporary filter that doesn't
persist when you restart innotop.  To create a quick-filter, press the '/' key.
innotop will prompt you for the column name and filter text.  Again, you can use
auto-completion on column names.  The filter text can be just the text you want
to &quot;search for.&quot;  For example, to filter the <a href="#processlist">processlist</a> table on queries
that refer to the products table, type '/' and then 'info product'.  Internally,
the filter is compiled into a subroutine like this:</p>
<pre>
 sub filter {
    my ( $set ) = @_;
    $set-&gt;{info} =~ m/product/;
 }</pre>
<p>The filter text can actually be any Perl regular expression, but of course a
literal string like 'product' works fine as a regular expression.</p>
<p>What if you want the filter to discard matching rows, rather than showing
matching rows?  If you're familiar with Perl regular expressions, you might
guess how to do this.  You have to use a zero-width negative lookahead
assertion.  If you don't know what that means, don't worry.  Let's filter out
all rows where the command is Gandalf.  Type the following:</p>
<pre>
 1. /
 2. cmd ^(?!Gandalf)</pre>
<p>Behind the scenes innotop compiles the quick-filter into a specially tagged
filter that is otherwise like any other filter.  It just isn't saved to the
configuration file.</p>
<p>To clear quick-filters, press the '\' key and innotop will clear them all at
once.</p>
<p>
</p>
<h2><a name="sorting">SORTING</a></h2>
<p>innotop has sensible built-in defaults to sort the most important rows to the
top of the table.  Like anything else in innotop, you can customize how any
table is sorted.</p>
<p>To start the sort dialog, start the <a href="#table_editor">TABLE EDITOR</a> with the '^' key, choose a
table if necessary, and press the 's' key.  You'll see a list of columns you can
use in the sort expression and the current sort expression, if any.  Enter a
list of columns by which you want to sort and press Enter.  If you want to
reverse sort, prefix the column name with a minus sign.  For example, if you
want to sort by column a ascending, then column b descending, type 'a -b'.  You
can also explicitly add a + in front of columns you want to sort ascending, but
it's not required.</p>
<p>Some modes have keys mapped to open this dialog directly, and to quickly reverse
sort direction.  Press '?' as usual to see which keys are mapped in any mode.</p>
<p>
</p>
<h2><a name="grouping">GROUPING</a></h2>
<p>innotop can group, or aggregate, rows together (the terms are used
interchangeably).  This is quite similar to an SQL GROUP BY clause.  You can
specify to group on certain columns, or if you don't specify any, the entire set
of rows is treated as one group.  This is quite like SQL so far, but unlike SQL,
you can also select un-grouped columns.  innotop actually aggregates every
column.  If you don't explicitly specify a grouping function, the default is
'first'.  This is basically a convenience so you don't have to specify an
aggregate function for every column you want in the result.</p>
<p>You can quickly toggle grouping on a table with the '=' key, which toggles its
aggregate property.  This property doesn't persist to the config file.</p>
<p>The columns by which the table is grouped are specified in its group_by
property.  When you turn grouping on, innotop places the group_by columns at the
far left of the table, even if they're not supposed to be visible.  The rest of
the visible columns appear in order after them.</p>
<p>Two tables have default group_by lists and a count column built in:
<a href="#processlist">processlist</a> and <a href="#innodb_transactions">innodb_transactions</a>.  The grouping is by connection
and status, so you can quickly see how many queries or transactions are in a
given status on each server you're monitoring.  The time columns are aggregated
as a sum; other columns are left at the default 'first' aggregation.</p>
<p>By default, the table shown in <a href="#s_variables_status">S: Variables &amp; Status</a> mode also uses
grouping so you can monitor variables and status across many servers.  The
default aggregation function in this mode is 'avg'.</p>
<p>Valid grouping functions are defined in the %agg_funcs hash.  They include</p>
<dl>
<dt><strong><a name="first" class="item">first</a></strong></dt>

<dd>
<p>Returns the first element in the group.</p>
</dd>
<dt><strong>count</strong></dt>

<dd>
<p>Returns the number of elements in the group, including undefined elements, much
like SQL's COUNT(*).</p>
</dd>
<dt><strong><a name="avg" class="item">avg</a></strong></dt>

<dd>
<p>Returns the average of defined elements in the group.</p>
</dd>
<dt><strong><a name="sum" class="item">sum</a></strong></dt>

<dd>
<p>Returns the sum of elements in the group.</p>
</dd>
</dl>
<p>Here's an example of grouping at work.  Suppose you have a very busy server with
hundreds of open connections, and you want to see how many connections are in
what status.  Using the built-in grouping rules, you can press 'Q' to enter
<a href="#q_query_list">Q: Query List</a> mode.  Press '=' to toggle grouping (if necessary, select the
<a href="#processlist">processlist</a> table when prompted).</p>
<p>Your display might now look like the following:</p>
<pre>
 Query List (? for help) localhost, 32:33, 0.11 QPS, 1 thd, 5.0.38-log
 
 CXN        Cmd        Cnt  ID      User   Host           Time   Query       
 localhost  Query      49    12933  webusr localhost      19:38  SELECT * FROM
 localhost  Sending Da 23     2383  webusr localhost      12:43  SELECT col1,
 localhost  Sleep      120     140  webusr localhost    5:18:12
 localhost  Statistics 12    19213  webusr localhost      01:19  SELECT * FROM</pre>
<p>That's actually quite a worrisome picture.  You've got a lot of idle connections
(Sleep), and some connections executing queries (Query and Sending Data).
That's okay, but you also have a lot in Statistics status, collectively spending
over a minute.  That means the query optimizer is having a really hard time
generating execution plans for your statements.  Something is wrong; it should
normally take milliseconds to plan queries.  You might not have seen this pattern if you
didn't look at your connections in aggregate.  (This is a made-up example, but
it can happen in real life).</p>
<p>
</p>
<h2><a name="pivoting">PIVOTING</a></h2>
<p>innotop can pivot a table for more compact display, similar to a Pivot Table in
a spreadsheet (also known as a crosstab).  Pivoting a table makes columns into
rows.  Assume you start with this table:</p>
<pre>
 foo bar
 === ===
 1   3
 2   4</pre>
<p>After pivoting, the table will look like this:</p>
<pre>
 name set0 set1
 ==== ==== ====
 foo  1    2
 bar  3    4</pre>
<p>To get reasonable results, you might need to group as well as pivoting.
innotop currently does this for <a href="#s_variables_status">S: Variables &amp; Status</a> mode.</p>
<p>
</p>
<h2><a name="colors">COLORS</a></h2>
<p>By default, innotop highlights rows with color so you can see at a glance which
rows are more important.  You can customize the colorization rules and add your
own to any table.  Open the table editor with the '^' key, choose a table if
needed, and press 'o' to open the color editor dialog.</p>
<p>The color editor dialog displays the rules applied to the table, in the order
they are evaluated.  Each row is evaluated against each rule to see if the rule
matches the row; if it does, the row gets the specified color, and no further
rules are evaluated.  The rules look like the following:</p>
<pre>
 state  eq  Locked       black on_red
 cmd    eq  Sleep        white       
 user   eq  system user  white       
 cmd    eq  Connect      white       
 cmd    eq  Binlog Dump  white       
 time   &gt;   600          red         
 time   &gt;   120          yellow      
 time   &gt;   60           green       
 time   &gt;   30           cyan</pre>
<p>This is the default rule set for the <a href="#processlist">processlist</a> table.  In order of
priority, these rules make locked queries black on a red background, &quot;gray out&quot;
connections from replication and sleeping queries, and make queries turn from
cyan to red as they run longer.</p>
<p>(For some reason, the ANSI color code &quot;white&quot; is actually a light gray.  Your
terminal's display may vary; experiment to find colors you like).</p>
<p>You can use keystrokes to move the rules up and down, which re-orders their
priority.  You can also delete rules and add new ones.  If you add a new rule,
innotop prompts you for the column, an operator for the comparison, a value
against which to compare the column, and a color to assign if the rule matches.
There is auto-completion and prompting at each step.</p>
<p>The value in the third step needs to be correctly quoted.  innotop does not try
to quote the value because it doesn't know whether it should treat the value as
a string or a number.  If you want to compare the column against a string, as
for example in the first rule above, you should enter 'Locked' surrounded by
quotes.  If you get an error message about a bareword, you probably should have
quoted something.</p>
<p>
</p>
<h2><a name="expressions">EXPRESSIONS</a></h2>
<p>Expressions are at the core of how innotop works, and are what enables you to
extend innotop as you wish.  Recall the table lifecycle explained in
<a href="#tables">TABLES</a>.  Expressions are used in the earliest step, where it extracts
values from a data source to form rows.</p>
<p>It does this by calling a subroutine for each column, passing it the source data
set, a set of current values, and a set of previous values.  These are all
needed so the subroutine can calculate things like the difference between this
tick and the previous tick.</p>
<p>The subroutines that extract the data from the set are compiled from
expressions.  This gives significantly more power than just naming the values to
fill the columns, because it allows the column's value to be calculated from
whatever data is necessary, but avoids the need to write complicated and lengthy
Perl code.</p>
<p>innotop begins with a string of text that can look as simple as a value's name
or as complicated as a full-fledged Perl expression.  It looks at each
'bareword' token in the string and decides whether it's supposed to be a key
into the $set hash.  A bareword is an unquoted value that isn't already
surrounded by code-ish things like dollar signs or curly brackets.  If innotop
decides that the bareword isn't a function or other valid Perl code, it converts
it into a hash access.  After the whole string is processed, innotop compiles a
subroutine, like this:</p>
<pre>
 sub compute_column_value {
    my ( $set, $cur, $pre ) = @_;
    my $val = # EXPANDED STRING GOES HERE
    return $val;
 }</pre>
<p>Here's a concrete example, taken from the header table <a href="#q_header">q_header</a> in <a href="#q_query_list">Q: Query List</a> mode.  This expression calculates the qps, or Queries Per Second,
column's values, from the values returned by SHOW STATUS:</p>
<pre>
 Questions/Uptime_hires</pre>
<p>innotop decides both words are barewords, and transforms this expression into
the following Perl code:</p>
<pre>
 $set-&gt;{Questions}/$set-&gt;{Uptime_hires}</pre>
<p>When surrounded by the rest of the subroutine's code, this is executable Perl
that calculates a high-resolution queries-per-second value.</p>
<p>The arguments to the subroutine are named $set, $cur, and $pre.  In most cases,
$set and $cur will be the same values.  However, if <a href="#status_inc">status_inc</a> is set, $cur
will not be the same as $set, because $set will already contain values that are
the incremental difference between $cur and $pre.</p>
<p>Every column in innotop is computed by subroutines compiled in the same fashion.
There is no difference between innotop's built-in columns and user-defined
columns.  This keeps things consistent and predictable.</p>
<p>
</p>
<h2><a name="transformations">TRANSFORMATIONS</a></h2>
<p>Transformations change how a value is rendered.  For example, they can take a
number of seconds and display it in H:M:S format.  The following transformations
are defined:</p>
<dl>
<dt><strong><a name="commify" class="item">commify</a></strong></dt>

<dd>
<p>Adds commas to large numbers every three decimal places.</p>
</dd>
<dt><strong><a name="dulint_to_int" class="item">dulint_to_int</a></strong></dt>

<dd>
<p>Accepts two unsigned integers and converts them into a single longlong.  This is
useful for certain operations with InnoDB, which uses two integers as
transaction identifiers, for example.</p>
</dd>
<dt><strong><a name="no_ctrl_char" class="item">no_ctrl_char</a></strong></dt>

<dd>
<p>Removes quoted control characters from the value.  This is affected by the
<a href="#charset">charset</a> configuration variable.</p>
<p>This transformation only operates within quoted strings, for example, values to
a SET clause in an UPDATE statement.  It will not alter the UPDATE statement,
but will collapse the quoted string to [BINARY] or [TEXT], depending on the
charset.</p>
</dd>
<dt><strong><a name="percent" class="item">percent</a></strong></dt>

<dd>
<p>Converts a number to a percentage by multiplying it by two, formatting it with
<a href="#num_digits">num_digits</a> digits after the decimal point, and optionally adding a percent
sign (see <a href="#show_percent">show_percent</a>).</p>
</dd>
<dt><strong><a name="secs_to_time" class="item">secs_to_time</a></strong></dt>

<dd>
<p>Formats a number of seconds as time in days+hours:minutes:seconds format.</p>
</dd>
<dt><strong><a name="set_precision" class="item">set_precision</a></strong></dt>

<dd>
<p>Formats numbers with <a href="#num_digits">num_digits</a> number of digits after the decimal point.</p>
</dd>
<dt><strong><a name="shorten" class="item">shorten</a></strong></dt>

<dd>
<p>Formats a number as a unit of 1024 (k/M/G/T) and with <a href="#num_digits">num_digits</a> number of
digits after the decimal point.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="table_editor">TABLE EDITOR</a></h2>
<p>The innotop table editor lets you customize tables with keystrokes.  You start
the table editor with the '^' key.  If there's more than one table on the
screen, it will prompt you to choose one of them.  Once you do, innotop will
show you something like this:</p>
<pre>
 Editing table definition for Buffer Pool.  Press ? for help, q to quit.
 
 name               hdr          label                  src          
 cxn                CXN          Connection from which  cxn          
 buf_pool_size      Size         Buffer pool size       IB_bp_buf_poo
 buf_free           Free Bufs    Buffers free in the b  IB_bp_buf_fre
 pages_total        Pages        Pages total            IB_bp_pages_t
 pages_modified     Dirty Pages  Pages modified (dirty  IB_bp_pages_m
 buf_pool_hit_rate  Hit Rate     Buffer pool hit rate   IB_bp_buf_poo
 total_mem_alloc    Memory       Total memory allocate  IB_bp_total_m
 add_pool_alloc     Add'l Pool   Additonal pool alloca  IB_bp_add_poo</pre>
<p>The first line shows which table you're editing, and reminds you again to press
'?' for a list of key mappings.  The rest is a tabular representation of the
table's columns, because that's likely what you're trying to edit.  However, you
can edit more than just the table's columns; this screen can start the filter
editor, color rule editor, and more.</p>
<p>Each row in the display shows a single column in the table you're editing, along
with a couple of its properties such as its header and source expression (see
<a href="#expressions">EXPRESSIONS</a>).</p>
<p>The key mappings are Vim-style, as in many other places.  Pressing 'j' and 'k'
moves the highlight up or down.  You can then (d)elete or (e)dit the highlighted
column.  You can also (a)dd a column to the table.  This actually just activates
one of the columns already defined for the table; it prompts you to choose from
among the columns available but not currently displayed.  Finally, you can
re-order the columns with the '+' and '-' keys.</p>
<p>You can do more than just edit the columns with the table editor, you can also
edit other properties, such as the table's sort expression and group-by
expression.  Press '?' to see the full list, of course.</p>
<p>If you want to really customize and create your own column, as opposed to just
activating a built-in one that's not currently displayed, press the (n)ew key,
and innotop will prompt you for the information it needs:</p>
<ul>
<li>
<p>The column name: this needs to be a word without any funny characters, e.g. just
letters, numbers and underscores.</p>
</li>
<li>
<p>The column header: this is the label that appears at the top of the column, in
the table header.  This can have spaces and funny characters, but be careful not
to make it too wide and waste space on-screen.</p>
</li>
<li>
<p>The column's data source: this is an expression that determines what data from
the source (see <a href="#tables">TABLES</a>) innotop will put into the column.  This can just be
the name of an item in the source, or it can be a more complex expression, as
described in <a href="#expressions">EXPRESSIONS</a>.</p>
</li>
</ul>
<p>Once you've entered the required data, your table has a new column.  There is no
difference between this column and the built-in ones; it can have all the same
properties and behaviors.  innotop will write the column's definition to the
configuration file, so it will persist across sessions.</p>
<p>Here's an example: suppose you want to track how many times your slaves have
retried transactions.  According to the MySQL manual, the
Slave_retried_transactions status variable gives you that data: &quot;The total
number of times since startup that the replication slave SQL thread has retried
transactions. This variable was added in version 5.0.4.&quot;  This is appropriate to
add to the <a href="#slave_sql_status">slave_sql_status</a> table.</p>
<p>To add the column, switch to the replication-monitoring mode with the 'M' key,
and press the '^' key to start the table editor.  When prompted, choose
slave_sql_status as the table, then press 'n' to create the column.  Type
'retries' as the column name, 'Retries' as the column header, and
'Slave_retried_transactions' as the source.  Now the column is created, and you
see the table editor screen again.  Press 'q' to exit the table editor, and
you'll see your column at the end of the table.</p>
<p>
</p>
<hr />
<h1><a name="variable_sets">VARIABLE SETS</a></h1>
<p>Variable sets are used in <a href="#s_variables_status">S: Variables &amp; Status</a> mode to define more easily
what variables you want to monitor.  Behind the scenes they are compiled to a
list of expressions, and then into a column list so they can be treated just
like columns in any other table, in terms of data extraction and
transformations.  However, you're protected from the tedious details by a syntax
that ought to feel very natural to you: a SQL SELECT list.</p>
<p>The data source for variable sets, and indeed the entire S mode, is the
combination of SHOW STATUS, SHOW VARIABLES, and SHOW INNODB STATUS.  Imagine
that you had a huge table with one column per variable returned from those
statements.  That's the data source for variable sets.  You can now query this
data source just like you'd expect.  For example:</p>
<pre>
 Questions, Uptime, Questions/Uptime as QPS</pre>
<p>Behind the scenes innotop will split that variable set into three expressions,
compile them and turn them into a table definition, then extract as usual.  This
becomes a &quot;variable set,&quot; or a &quot;list of variables you want to monitor.&quot;</p>
<p>innotop lets you name and save your variable sets, and writes them to the
configuration file.  You can choose which variable set you want to see with the
'c' key, or activate the next and previous sets with the '&gt;' and '&lt;' keys.
There are many built-in variable sets as well, which should give you a good
start for creating your own.  Press 'e' to edit the current variable set, or
just to see how it's defined.  To create a new one, just press 'c' and type its
name.</p>
<p>You may want to use some of the functions listed in <a href="#transformations">TRANSFORMATIONS</a> to help
format the results.  In particular, <a href="#set_precision">set_precision</a> is often useful to limit
the number of digits you see.  Extending the above example, here's how:</p>
<pre>
 Questions, Uptime, set_precision(Questions/Uptime) as QPS</pre>
<p>Actually, this still needs a little more work.  If your <a href="#interval">interval</a> is less
than one second, you might be dividing by zero because Uptime is incremental in
this mode by default.  Instead, use Uptime_hires:</p>
<pre>
 Questions, Uptime, set_precision(Questions/Uptime_hires) as QPS</pre>
<p>This example is simple, but it shows how easy it is to choose which variables
you want to monitor.</p>
<p>
</p>
<hr />
<h1><a name="plugins">PLUGINS</a></h1>
<p>innotop has a simple but powerful plugin mechanism by which you can extend
or modify its existing functionality, and add new functionality.  innotop's
plugin functionality is event-based: plugins register themselves to be called
when events happen.  They then have a chance to influence the event.</p>
<p>An innotop plugin is a Perl module placed in innotop's <a href="#plugin_dir">plugin_dir</a>
directory.  On UNIX systems, you can place a symbolic link to the module instead
of putting the actual file there.  innotop automatically discovers the file.  If
there is a corresponding entry in the <a href="#plugins">plugins</a> configuration file section,
innotop loads and activates the plugin.</p>
<p>The module must conform to innotop's plugin interface.  Additionally, the source
code of the module must be written in such a way that innotop can inspect the
file and determine the package name and description.</p>
<p>
</p>
<h2><a name="package_source_convention">Package Source Convention</a></h2>
<p>innotop inspects the plugin module's source to determine the Perl package name.
It looks for a line of the form &quot;package Foo;&quot; and if found, considers the
plugin's package name to be Foo.  Of course the package name can be a valid Perl
package name, with double semicolons and so on.</p>
<p>It also looks for a description in the source code, to make the plugin editor
more human-friendly.  The description is a comment line of the form &quot;#
description: Foo&quot;, where &quot;Foo&quot; is the text innotop will consider to be the
plugin's description.</p>
<p>
</p>
<h2><a name="plugin_interface">Plugin Interface</a></h2>
<p>The innotop plugin interface is quite simple: innotop expects the plugin to be
an object-oriented module it can call certain methods on.  The methods are</p>
<dl>
<dt><strong><a name="new" class="item"><code>new(%variables)</code></a></strong></dt>

<dd>
<p>This is the plugin's constructor.  It is passed a hash of innotop's variables,
which it can manipulate (see <a href="#plugin_variables">Plugin Variables</a>).  It must return a reference
to the newly created plugin object.</p>
<p>At construction time, innotop has only loaded the general configuration and
created the default built-in variables with their default contents (which is
quite a lot).  Therefore, the state of the program is exactly as in the innotop
source code, plus the configuration variables from the <a href="#general">general</a> section in
the config file.</p>
<p>If your plugin manipulates the variables, it is changing global data, which is
shared by innotop and all plugins.  Plugins are loaded in the order they're
listed in the config file.  Your plugin may load before or after another plugin,
so there is a potential for conflict or interaction between plugins if they
modify data other plugins use or modify.</p>
</dd>
<dt><strong><a name="register_for_events" class="item"><code>register_for_events()</code></a></strong></dt>

<dd>
<p>This method must return a list of events in which the plugin is interested, if
any.  See <a href="#plugin_events">Plugin Events</a> for the defined events.  If the plugin returns an
event that's not defined, the event is ignored.</p>
</dd>
<dt><strong><a name="event_handlers" class="item">event handlers</a></strong></dt>

<dd>
<p>The plugin must implement a method named the same as each event for which it has
registered.  In other words, if the plugin returns qw(foo bar) from
<a href="#register_for_events"><code>register_for_events()</code></a>, it must have <code>foo()</code> and <code>bar()</code> methods.  These methods are
callbacks for the events.  See <a href="#plugin_events">Plugin Events</a> for more details about each
event.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="plugin_variables">Plugin Variables</a></h2>
<p>The plugin's constructor is passed a hash of innotop's variables, which it can
manipulate.  It is probably a good idea if the plugin object saves a copy of it
for later use.  The variables are defined in the innotop variable
%pluggable_vars, and are as follows:</p>
<dl>
<dt><strong><a name="action_for" class="item">action_for</a></strong></dt>

<dd>
<p>A hashref of key mappings.  These are innotop's global hot-keys.</p>
</dd>
<dt><strong><a name="agg_funcs" class="item">agg_funcs</a></strong></dt>

<dd>
<p>A hashref of functions that can be used for grouping.  See <a href="#grouping">GROUPING</a>.</p>
</dd>
<dt><strong>config</strong></dt>

<dd>
<p>The global configuration hash.</p>
</dd>
<dt><strong>connections</strong></dt>

<dd>
<p>A hashref of connection specifications.  These are just specifications of how to
connect to a server.</p>
</dd>
<dt><strong><a name="dbhs" class="item">dbhs</a></strong></dt>

<dd>
<p>A hashref of innotop's database connections.  These are actual DBI connection
objects.</p>
</dd>
<dt><strong>filters</strong></dt>

<dd>
<p>A hashref of filters applied to table rows.  See <a href="#filters">FILTERS</a> for more.</p>
</dd>
<dt><strong><a name="modes" class="item">modes</a></strong></dt>

<dd>
<p>A hashref of modes.  See <a href="#modes">MODES</a> for more.</p>
</dd>
<dt><strong>server_groups</strong></dt>

<dd>
<p>A hashref of server groups.  See <a href="#server_groups">SERVER GROUPS</a>.</p>
</dd>
<dt><strong>tbl_meta</strong></dt>

<dd>
<p>A hashref of innotop's table meta-data, with one entry per table (see
<a href="#tables">TABLES</a> for more information).</p>
</dd>
<dt><strong><a name="trans_funcs" class="item">trans_funcs</a></strong></dt>

<dd>
<p>A hashref of transformation functions.  See <a href="#transformations">TRANSFORMATIONS</a>.</p>
</dd>
<dt><strong><a name="var_sets" class="item">var_sets</a></strong></dt>

<dd>
<p>A hashref of variable sets.  See <a href="#variable_sets">VARIABLE SETS</a>.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="plugin_events">Plugin Events</a></h2>
<p>Each event is defined somewhere in the innotop source code.  When innotop runs
that code, it executes the callback function for each plugin that expressed its
interest in the event.  innotop passes some data for each event.  The events are
defined in the %event_listener_for variable, and are as follows:</p>
<dl>
<dt><strong><a name="extract_values" class="item">extract_values($set, $cur, $pre, $tbl)</a></strong></dt>

<dd>
<p>This event occurs inside the function that extracts values from a data source.
The arguments are the set of values, the current values, the previous values,
and the table name.</p>
</dd>
<dt><strong><a name="set_to_tbl" class="item">set_to_tbl</a></strong></dt>

<dd>
<p>Events are defined at many places in this subroutine, which is responsible for
turning an arrayref of hashrefs into an arrayref of lines that can be printed to
the screen.  The events all pass the same data: an arrayref of rows and the name
of the table being created.  The events are set_to_tbl_pre_filter,
set_to_tbl_pre_sort,set_to_tbl_pre_group, set_to_tbl_pre_colorize,
set_to_tbl_pre_transform, set_to_tbl_pre_pivot, set_to_tbl_pre_create,
set_to_tbl_post_create.</p>
</dd>
<dt><strong><a name="draw_screen" class="item"><code>draw_screen($lines)</code></a></strong></dt>

<dd>
<p>This event occurs inside the subroutine that prints the lines to the screen.
$lines is an arrayref of strings.</p>
</dd>
</dl>
<p>
</p>
<h2><a name="simple_plugin_example">Simple Plugin Example</a></h2>
<p>The easiest way to explain the plugin functionality is probably with a simple
example.  The following module adds a column to the beginning of every table and
sets its value to 1.</p>
<pre>
 use strict;
 use warnings FATAL =&gt; 'all';
 
 package Innotop::Plugin::Example;
 # description: Adds an 'example' column to every table
 
 sub new {
    my ( $class, %vars ) = @_;
    # Store reference to innotop's variables in $self
    my $self = bless { %vars }, $class;
 
    # Design the example column
    my $col = {
       hdr   =&gt; 'Example',
       just  =&gt; '',
       dec   =&gt; 0,
       num   =&gt; 1,
       label =&gt; 'Example',
       src   =&gt; 'example', # Get data from this column in the data source
       tbl   =&gt; '',
       trans =&gt; [],
    };
 
    # Add the column to every table.
    my $tbl_meta = $vars{tbl_meta};
    foreach my $tbl ( values %$tbl_meta ) {
       # Add the column to the list of defined columns
       $tbl-&gt;{cols}-&gt;{example} = $col;
       # Add the column to the list of visible columns
       unshift @{$tbl-&gt;{visible}}, 'example';
    }
 
    # Be sure to return a reference to the object.
    return $self;
 }
 
 # I'd like to be called when a data set is being rendered into a table, please.
 sub register_for_events {
    my ( $self ) = @_;
    return qw(set_to_tbl_pre_filter);
 }
 
 # This method will be called when the event fires.
 sub set_to_tbl_pre_filter {
    my ( $self, $rows, $tbl ) = @_;
    # Set the example column's data source to the value 1.
    foreach my $row ( @$rows ) {
       $row-&gt;{example} = 1;
    }
 }
 
 1;</pre>
<p>
</p>
<h2><a name="plugin_editor">Plugin Editor</a></h2>
<p>The plugin editor lets you view the plugins innotop discovered and activate or
deactivate them.  Start the editor by pressing $ to start the configuration
editor from any mode.  Press the 'p' key to start the plugin editor.  You'll see
a list of plugins innotop discovered.  You can use the 'j' and 'k' keys to move
the highlight to the desired one, then press the * key to toggle it active or
inactive.  Exit the editor and restart innotop for the changes to take effect.</p>
<p>
</p>
<hr />
<h1><a name="sql_statements">SQL STATEMENTS</a></h1>
<p>innotop uses a limited set of SQL statements to retrieve data from MySQL for
display.  The statements are customized depending on the server version against
which they are executed; for example, on MySQL 5 and newer, INNODB_STATUS
executes &quot;SHOW ENGINE INNODB STATUS&quot;, while on earlier versions it executes
&quot;SHOW INNODB STATUS&quot;.  The statements are as follows:</p>
<pre>
 Statement           SQL executed
 =================== ===============================
 INDEX_STATISTICS    SELECT * FROM INFORMATION_SCHEMA.INDEX_STATISTICS
 INNODB_STATUS       SHOW [ENGINE] INNODB STATUS
 KILL_CONNECTION     KILL
 KILL_QUERY          KILL QUERY
 OPEN_TABLES         SHOW OPEN TABLES
 PROCESSLIST         SHOW FULL PROCESSLIST
 SHOW_MASTER_LOGS    SHOW MASTER LOGS
 SHOW_MASTER_STATUS  SHOW MASTER STATUS
 SHOW_SLAVE_STATUS   SHOW SLAVE STATUS
 SHOW_STATUS         SHOW [GLOBAL] STATUS
 SHOW_VARIABLES      SHOW [GLOBAL] VARIABLES
 TABLE_STATISTICS    SELECT * FROM INFORMATION_SCHEMA.TABLE_STATISTICS</pre>
<p>
</p>
<hr />
<h1><a name="data_sources">DATA SOURCES</a></h1>
<p>Each time innotop extracts values to create a table (see <a href="#expressions">EXPRESSIONS</a> and
<a href="#tables">TABLES</a>), it does so from a particular data source.  Largely because of the
complex data extracted from SHOW INNODB STATUS, this is slightly messy.  SHOW
INNODB STATUS contains a mixture of single values and repeated values that form
nested data sets.</p>
<p>Whenever innotop fetches data from MySQL, it adds two extra bits to each set:
cxn and Uptime_hires.  cxn is the name of the connection from which the data
came.  Uptime_hires is a high-resolution version of the server's Uptime status
variable, which is important if your <a href="#interval">interval</a> setting is sub-second.</p>
<p>Here are the kinds of data sources from which data is extracted:</p>
<dl>
<dt><strong><a name="status_variables" class="item">STATUS_VARIABLES</a></strong></dt>

<dd>
<p>This is the broadest category, into which the most kinds of data fall.  It
begins with the combination of SHOW STATUS and SHOW VARIABLES, but other sources
may be included as needed, for example, SHOW MASTER STATUS and SHOW SLAVE
STATUS, as well as many of the non-repeated values from SHOW INNODB STATUS.</p>
</dd>
<dt><strong><a name="deadlock_locks" class="item">DEADLOCK_LOCKS</a></strong></dt>

<dd>
<p>This data is extracted from the transaction list in the LATEST DETECTED DEADLOCK
section of SHOW INNODB STATUS.  It is nested two levels deep: transactions, then
locks.</p>
</dd>
<dt><strong><a name="deadlock_transactions" class="item">DEADLOCK_TRANSACTIONS</a></strong></dt>

<dd>
<p>This data is from the transaction list in the LATEST DETECTED DEADLOCK
section of SHOW INNODB STATUS.  It is nested one level deep.</p>
</dd>
<dt><strong><a name="explain" class="item">EXPLAIN</a></strong></dt>

<dd>
<p>This data is from the result set returned by EXPLAIN.</p>
</dd>
<dt><strong><a name="innodb_transactions" class="item">INNODB_TRANSACTIONS</a></strong></dt>

<dd>
<p>This data is from the TRANSACTIONS section of SHOW INNODB STATUS.</p>
</dd>
<dt><strong><a name="io_threads" class="item">IO_THREADS</a></strong></dt>

<dd>
<p>This data is from the list of threads in the the FILE I/O section of SHOW INNODB
STATUS.</p>
</dd>
<dt><strong><a name="innodb_locks" class="item">INNODB_LOCKS</a></strong></dt>

<dd>
<p>This data is from the TRANSACTIONS section of SHOW INNODB STATUS and is nested
two levels deep.</p>
</dd>
<dt><strong><a name="open_tables" class="item">OPEN_TABLES</a></strong></dt>

<dd>
<p>This data is from SHOW OPEN TABLES.</p>
</dd>
<dt><strong><a name="processlist" class="item">PROCESSLIST</a></strong></dt>

<dd>
<p>This data is from SHOW FULL PROCESSLIST.</p>
</dd>
<dt><strong><a name="os_wait_array" class="item">OS_WAIT_ARRAY</a></strong></dt>

<dd>
<p>This data is from the SEMAPHORES section of SHOW INNODB STATUS and is nested one
level deep.  It comes from the lines that look like this:</p>
<pre>
 --Thread 1568861104 has waited at btr0cur.c line 424 ....</pre>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="mysql_privileges">MYSQL PRIVILEGES</a></h1>
<ul>
<li>
<p>You must connect to MySQL as a user who has the SUPER privilege for many of the
functions.</p>
</li>
<li>
<p>If you don't have the SUPER privilege, you can still run some functions, but you
won't necessarily see all the same data.</p>
</li>
<li>
<p>You need the PROCESS privilege to see the list of currently running queries in Q
mode.</p>
</li>
<li>
<p>You need special privileges to start and stop slave servers.</p>
</li>
<li>
<p>You need appropriate privileges to create and drop the deadlock tables if needed
(see <a href="#server_connections">SERVER CONNECTIONS</a>).</p>
</li>
</ul>
<p>
</p>
<hr />
<h1><a name="system_requirements">SYSTEM REQUIREMENTS</a></h1>
<p>You need Perl to run innotop, of course.  You also need a few Perl modules: DBI,
DBD::mysql,  Term::ReadKey, and Time::HiRes.  These should be included with most
Perl distributions, but in case they are not, I recommend using versions
distributed with your operating system or Perl distribution, not from CPAN.
Term::ReadKey in particular has been known to cause problems if installed from
CPAN.</p>
<p>If you have Term::ANSIColor, innotop will use it to format headers more readably
and compactly.  (Under Microsoft Windows, you also need Win32::Console::ANSI for
terminal formatting codes to be honored).  If you install Term::ReadLine,
preferably Term::ReadLine::Gnu, you'll get nice auto-completion support.</p>
<p>I run innotop on Gentoo GNU/Linux, Debian and Ubuntu, and I've had feedback from
people successfully running it on Red Hat, CentOS, Solaris, and Mac OSX.  I
don't see any reason why it won't work on other UNIX-ish operating systems, but
I don't know for sure.  It also runs on Windows under ActivePerl without
problem.</p>
<p>innotop has been used on MySQL versions 3.23.58, 4.0.27, 4.1.0, 4.1.22, 5.0.26,
5.1.15, and 5.2.3.  If it doesn't run correctly for you, that is a bug that
should be reported.</p>
<p>
</p>
<hr />
<h1><a name="files">FILES</a></h1>
<p>$HOMEDIR/.innotop and/or /etc/innotop are used to store
configuration information.  Files include the configuration file innotop.conf,
the core_dump file which contains verbose error messages if <a href="#debug">debug</a> is
enabled, and the plugins/ subdirectory.</p>
<p>
</p>
<hr />
<h1><a name="glossary_of_terms">GLOSSARY OF TERMS</a></h1>
<dl>
<dt><strong><a name="tick" class="item">tick</a></strong></dt>

<dd>
<p>A tick is a refresh event, when innotop re-fetches data from connections and
displays it.</p>
</dd>
</dl>
<p>
</p>
<hr />
<h1><a name="acknowledgements">ACKNOWLEDGEMENTS</a></h1>
<p>The following people and organizations are acknowledged for various reasons.
Hopefully no one has been forgotten.</p>
<p>Aaron Racine,
Allen K. Smith,
Aurimas Mikalauskas,
Bartosz Fenski,
Brian Miezejewski,
Christian Hammers, 
Cyril Scetbon,
Dane Miller,
David Multer,
Dr. Frank Ullrich,
Giuseppe Maxia,
Google.com Site Reliability Engineers,
Google Code,
Jan Pieter Kunst,
Jari Aalto,
Jay Pipes,
Jeremy Zawodny,
Johan Idren,
Kristian Kohntopp,
Lenz Grimmer,
Maciej Dobrzanski,
Michiel Betel,
MySQL AB,
Paul McCullagh,
Sebastien Estienne,
Sourceforge.net,
Steven Kreuzer,
The Gentoo MySQL Team,
Trevor Price,
Yaar Schnitman,
and probably more people that have not been included.</p>
<p>(If your name has been misspelled, it's probably out of fear of putting
international characters into this documentation; earlier versions of Perl might
not be able to compile it then).</p>
<p>
</p>
<hr />
<h1><a name="copyright__license_and_warranty">COPYRIGHT, LICENSE AND WARRANTY</a></h1>
<p>This program is copyright (c) 2006 Baron Schwartz.
Feedback and improvements are welcome.</p>
<p>THIS PROGRAM IS PROVIDED &quot;AS IS&quot; AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.</p>
<p>This program is free software; you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, version 2; OR the Perl Artistic License.  On UNIX and similar
systems, you can issue `man perlgpl' or `man perlartistic' to read these
licenses.</p>
<p>You should have received a copy of the GNU General Public License along with
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
Place, Suite 330, Boston, MA  02111-1307  USA.</p>
<p>Execute innotop and press '!' to see this information at any time.</p>
<p>
</p>
<hr />
<h1><a name="author">AUTHOR</a></h1>
<p>Originally written by Baron Schwartz; currently maintained by Aaron Racine.</p>
<p>
</p>
<hr />
<h1><a name="bugs">BUGS</a></h1>
<p>You can report bugs, ask for improvements, and get other help and support at
<a href="http://code.google.com/p/innotop/">http://code.google.com/p/innotop/</a>.  There are mailing lists, a source code
browser, a bug tracker, etc.  Please use these instead of contacting the
maintainer or author directly, as it makes our job easier and benefits others if the
discussions are permanent and public.  Of course, if you need to contact us in
private, please do.</p>

		</div>
		<div class="navigation">
			<h2>Navigation</h2>
			<ul>
				<li><a href="installing.html">Installing innotop</a></li>
				<li><a href="manual.html">The innotop man page</a></li>
            <li><a href="screenshots.html">Screenshots</a></li>
			</ul>
		</div>
		<div class="clearer">&nbsp;</div>
	</div>
	<div class="footer">
		<span class="right"><a href="http://templates.arcsin.se/">Website template</a> by <a href="http://arcsin.se/">Arcsin</a></span>
		<div class="clearer"></div>
	</div>
</div>
</div>
</body>
</html>
